diff options
Diffstat (limited to 'lib/child_process.js')
-rw-r--r-- | lib/child_process.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/child_process.js b/lib/child_process.js index 2e9c71c1ef..2962f5cf05 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -469,14 +469,19 @@ function normalizeSpawnArguments(file, args, options) { if (options.shell) { const command = [file].concat(args).join(' '); - + // Set the shell, switches, and commands. if (process.platform === 'win32') { if (typeof options.shell === 'string') file = options.shell; else file = process.env.comspec || 'cmd.exe'; - args = ['/d', '/s', '/c', `"${command}"`]; - options.windowsVerbatimArguments = true; + // '/d /s /c' is used only for cmd.exe. + if (/^(?:.*\\)?cmd(?:\.exe)?$/i.test(file)) { + args = ['/d', '/s', '/c', `"${command}"`]; + options.windowsVerbatimArguments = true; + } else { + args = ['-c', command]; + } } else { if (typeof options.shell === 'string') file = options.shell; |