Skip to content

Commit

Permalink
fix(cli): case-insensitive PATH key on Win32 (wix#2281)
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph authored Aug 19, 2020
1 parent 3b1c3ff commit 9656ba4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion detox-cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ function spawnDetoxBinary(cliArgs) {
return 1;
}

const PATH = isWin32 ? findPathKey() : 'PATH';
const spawnOptions = {
stdio: 'inherit',
env: {
...process.env,
PATH: [nodeBinariesPath, process.env.PATH].join(path.delimiter),
[PATH]: [nodeBinariesPath, process.env.PATH].join(path.delimiter),
}
};

Expand All @@ -57,4 +58,12 @@ function spawnRecorder([_recorder, ...recorderArgs]) {
}
}

function findPathKey() {
return Object.keys(process.env).find(isCaseInsensitivePath);
}

function isCaseInsensitivePath(key) {
return key.toLowerCase() === 'path';
}

process.exit(main(process.argv));

0 comments on commit 9656ba4

Please sign in to comment.