Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gitDir Bug for git specific executables #162

Merged
merged 9 commits into from
May 17, 2017
5 changes: 3 additions & 2 deletions src/runScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ module.exports = function runScript(commands, pathsToLint, packageJson, options)
task: () => {
try {
const res = findBin(linter, pathsToLint, packageJson, options)
// Only use gitDir as CWD if we are using the git binary
// e.g `npm` should run tasks in the actual CWD
const execaOptions =
res.bin !== 'npm' && options && options.gitDir ? { cwd: options.gitDir } : {}
res.bin.endsWith('git') && options && options.gitDir ? { cwd: options.gitDir } : {}
return new Promise((resolve, reject) => {
execa(res.bin, res.args, execaOptions)
.then(() => {
Expand All @@ -29,4 +31,3 @@ ${ err.stdout }`))
}
}))
}