diff --git a/test/parallel/test-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js index 3843ba1f77e624..94a34b640d1e3c 100644 --- a/test/parallel/test-spawn-cmd-named-pipe.js +++ b/test/parallel/test-spawn-cmd-named-pipe.js @@ -37,15 +37,10 @@ if (!process.argv[2]) { }); stdoutPipeServer.listen(stdoutPipeName); - const comspec = process.env['comspec']; - if (!comspec || comspec.length === 0) { - assert.fail('Failed to get COMSPEC'); - } + const args = + [`"${__filename}"`, 'child', '<', stdinPipeName, '>', stdoutPipeName]; - const args = ['/c', process.execPath, __filename, 'child', - '<', stdinPipeName, '>', stdoutPipeName]; - - const child = spawn(comspec, args); + const child = spawn(`"${process.execPath}"`, args, { shell: true }); child.on('exit', common.mustCall(function(exitCode) { stdinPipeServer.close();