Skip to content

Commit 7ffd545

Browse files
authored
fix: windows exec resolution (#1274)
Fixes #1251
1 parent 0f39b2e commit 7ffd545

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/monitor/run.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,26 @@ function run(options) {
4848
stdio: stdio,
4949
}
5050

51+
var executable = cmd.executable;
52+
5153
if (utils.isWindows) {
54+
// if the exec includes a forward slash, reverse it for windows compat
55+
// but *only* apply to the first command, and none of the arguments.
56+
// ref #1251 and #1236
57+
if (executable.indexOf('/') !== -1) {
58+
executable = executable.split(' ').map((e, i) => {
59+
if (i === 0) {
60+
return path.normalize(e);
61+
}
62+
return e;
63+
}).join(' ');
64+
}
5265
// taken from npm's cli: https://git.io/vNFD4
5366
sh = process.env.comspec || 'cmd';
5467
shFlag = '/d /s /c';
5568
spawnOptions.windowsVerbatimArguments = true;
5669
}
5770

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

0 commit comments

Comments
 (0)