Skip to content

Commit 096080b

Browse files
Trottaddaleax
authored andcommitted
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: #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 1b3cf97 commit 096080b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/child_process.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,11 @@ function normalizeSpawnArguments(file, args, options) {
442442
const command = [file].concat(args).join(' ');
443443

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

0 commit comments

Comments
 (0)