diff options
author | Rich Trott <rtrott@gmail.com> | 2017-07-09 13:03:17 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-07-12 12:09:43 -0700 |
commit | 6d090e10949715f1e143b383894db290174feab0 (patch) | |
tree | 1ee2aefae27f06906c63d454378b060885859b9a /lib/child_process.js | |
parent | 7f26a291f60dbddcd9c9ad216d268844eff0f53f (diff) | |
download | android-node-v8-6d090e10949715f1e143b383894db290174feab0.tar.gz android-node-v8-6d090e10949715f1e143b383894db290174feab0.tar.bz2 android-node-v8-6d090e10949715f1e143b383894db290174feab0.zip |
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>
Diffstat (limited to 'lib/child_process.js')
-rw-r--r-- | lib/child_process.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/child_process.js b/lib/child_process.js index a2a576e946..77f02a0ed2 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -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') |