Skip to content

Commit 6d090e1

Browse files
committed
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: nodejs#14149 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 7f26a29 commit 6d090e1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/child_process.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,11 @@ function normalizeSpawnArguments(file, args, options) {
440440
const command = [file].concat(args).join(' ');
441441

442442
if (process.platform === 'win32') {
443-
file = typeof options.shell === 'string' ? options.shell :
444-
process.env.comspec || 'cmd.exe';
445-
args = ['/d', '/s', '/c', '"' + command + '"'];
443+
if (typeof options.shell === 'string')
444+
file = options.shell;
445+
else
446+
file = process.env.comspec || 'cmd.exe';
447+
args = ['/d', '/s', '/c', `"${command}"`];
446448
options.windowsVerbatimArguments = true;
447449
} else {
448450
if (typeof options.shell === 'string')

0 commit comments

Comments
 (0)