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 <[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]>
  • Loading branch information
Trott authored and addaleax committed Jul 18, 2017
1 parent 1b3cf97 commit 096080b
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 @@ -442,9 +442,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 096080b

Please sign in to comment.