-
-
Notifications
You must be signed in to change notification settings - Fork 248
execa does not respect $PATH variable #153
Copy link
Copy link
Closed
Labels
Milestone
Description
I have two installations of git and execa seems to pick the wrong one, not respecting $PATH correctly, while child-process does it correctly (even if I explicitly remove /usr/bin from $PTAH and add my desired path twice, once in the beginning and once in the end):
$ /usr/bin/git --version
git version 1.8.3.1
$ /opt/rh/rh-git29/root/usr/bin/git --version
git version 2.9.3
$ echo $PATH
/opt/rh/rh-git29/root/usr/bin:/bin:/usr/local/bin:/opt/rh/rh-git29/root/usr/bin
$ cat ./index.js
const execa = require('execa');
(async () => {
const {stdout} = await execa('git', ['--version']);
console.log(stdout);
//=> 'unicorns'
})();
const execFile = require('child_process').execFile;
const child = execFile('git', ['--version'], (error, stdout, stderr) => {
if (error) {
console.error('stderr', stderr);
throw error;
}
console.log('stdout', stdout);
});
$ node ./index.js
git version 1.8.3.1
stdout git version 2.9.3
I am missing something here?
Reactions are currently unavailable