Skip to content

Commit

Permalink
child_process: refactor normalizeSpawnArguments()
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
Trott committed Jul 12, 2017
1 parent 7f26a29 commit 6d090e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6d090e1

Please sign in to comment.