Skip to content

Commit

Permalink
fix: windows exec resolution (#1274)
Browse files Browse the repository at this point in the history
Fixes #1251
  • Loading branch information
remy committed Feb 27, 2018
1 parent 0f39b2e commit 7ffd545
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/monitor/run.js
Expand Up @@ -48,14 +48,26 @@ function run(options) {
stdio: stdio,
}

var executable = cmd.executable;

if (utils.isWindows) {
// if the exec includes a forward slash, reverse it for windows compat
// but *only* apply to the first command, and none of the arguments.
// ref #1251 and #1236
if (executable.indexOf('/') !== -1) {
executable = executable.split(' ').map((e, i) => {
if (i === 0) {
return path.normalize(e);
}
return e;
}).join(' ');
}
// taken from npm's cli: https://git.io/vNFD4
sh = process.env.comspec || 'cmd';
shFlag = '/d /s /c';
spawnOptions.windowsVerbatimArguments = true;
}

var executable = cmd.executable;
var args = runCmd ? utils.stringify(executable, cmd.args) : ':';
var spawnArgs = [sh, [shFlag, args], spawnOptions];

Expand Down

0 comments on commit 7ffd545

Please sign in to comment.