Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit fe0d48a

Browse files
Noah Leighzkat
Noah Leigh
authored andcommittedApr 12, 2018
fix(windows): Allow spaces in the node path when using --node-arg (#173)
Fixes: #170
1 parent 13fea31 commit fe0d48a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function execCommand (_existing, argv) {
283283
nargs = nargs.reduce((acc, arg) => {
284284
return acc.concat(arg.split(/\s+/))
285285
}, [])
286-
cmd = process.argv[0]
286+
cmd = child.escapeArg(process.argv[0], true)
287287
opts = Object.assign({}, argv, {
288288
cmdOpts: nargs.concat([existing], argv.cmdOpts || [])
289289
})

‎test/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,16 @@ test('nice error message when no binaries on windows', {
294294
t.end()
295295
})
296296
})
297+
298+
test('--node-arg works on Windows', {
299+
skip: !isWindows && 'Only on Windows does --node-arg have issues'
300+
}, t => {
301+
return child.spawn('node', [
302+
NPX_ESC, '--quiet',
303+
'--node-arg', '--no-deprecation',
304+
'echo-cli', 'hewwo'
305+
], {stdio: 'pipe'}).then(res => {
306+
t.equal(res.stdout.trim(), 'hewwo')
307+
t.end()
308+
})
309+
})

0 commit comments

Comments
 (0)
This repository has been archived.