test: make a test path-independent

parallel/test-spawn-cmd-named-pipe.js failed with spaces
both in node.exe and test paths.

PR-URL: https://github.com/nodejs/node/pull/12945
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Vse Mozhet Byt 2017-05-10 07:53:18 +03:00
parent 15410797f2
commit 529e4f206a

View File

@ -37,15 +37,10 @@ if (!process.argv[2]) {
}); });
stdoutPipeServer.listen(stdoutPipeName); stdoutPipeServer.listen(stdoutPipeName);
const comspec = process.env['comspec']; const args =
if (!comspec || comspec.length === 0) { [`"${__filename}"`, 'child', '<', stdinPipeName, '>', stdoutPipeName];
assert.fail('Failed to get COMSPEC');
}
const args = ['/c', process.execPath, __filename, 'child', const child = spawn(`"${process.execPath}"`, args, { shell: true });
'<', stdinPipeName, '>', stdoutPipeName];
const child = spawn(comspec, args);
child.on('exit', common.mustCall(function(exitCode) { child.on('exit', common.mustCall(function(exitCode) {
stdinPipeServer.close(); stdinPipeServer.close();