mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
child_process: refactor normalizeSpawnArguments()
Code is not in hot path. Refactor ternary to be more readable if/else block that mirrors analogous code elsewhere in the function. Change string concatenation to template literal. PR-URL: https://github.com/nodejs/node/pull/14149 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
1 parent
7f26a291f6
commit
6d090e1094
1 file changed
+5
-3
@@ -440,9 +440,11 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
const command = [file].concat(args).join(' ');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
file = typeof options.shell === 'string' ? options.shell :
|
||||
process.env.comspec || 'cmd.exe';
|
||||
args = ['/d', '/s', '/c', '"' + command + '"'];
|
||||
if (typeof options.shell === 'string')
|
||||
file = options.shell;
|
||||
else
|
||||
file = process.env.comspec || 'cmd.exe';
|
||||
args = ['/d', '/s', '/c', `"${command}"`];
|
||||
options.windowsVerbatimArguments = true;
|
||||
} else {
|
||||
if (typeof options.shell === 'string')
|
||||
|
||||
Reference in new issue
Block a user