diff options
author | isaacs <i@izs.me> | 2019-08-22 10:58:06 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2019-08-22 11:04:14 +0300 |
commit | 6cc4cc66f1fb050dc4113e35cab59197fd48e04a (patch) | |
tree | 15a438700023efbff39d0bf05df0cd827e23814e /lib/explore.js | |
parent | bf93e91d879c816a055d5913e6e4210d7299f299 (diff) |
explore: escape args properly on Windows Bash
Despite being bash, Node.js running on windows git mingw bash still
executes child processes using cmd.exe. As a result, arguments in this
environment need to be escaped in the style of cmd.exe, not bash.
Diffstat (limited to 'lib/explore.js')
-rw-r--r-- | lib/explore.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/explore.js b/lib/explore.js index 826a527fa..0c9930f8e 100644 --- a/lib/explore.js +++ b/lib/explore.js @@ -9,10 +9,11 @@ var npm = require('./npm.js') var spawn = require('./utils/spawn') var path = require('path') var fs = require('graceful-fs') -var isWindowsShell = require('./utils/is-windows-shell.js') +var isWindows = require('./utils/is-windows.js') var escapeExecPath = require('./utils/escape-exec-path.js') var escapeArg = require('./utils/escape-arg.js') var output = require('./utils/output.js') +var log = require('npmlog') function explore (args, cb) { if (args.length < 1 || !args[0]) return cb(explore.usage) @@ -23,7 +24,7 @@ function explore (args, cb) { var shellArgs = [] if (args) { - if (isWindowsShell) { + if (isWindows) { var execCmd = escapeExecPath(args.shift()) var execArgs = [execCmd].concat(args.map(escapeArg)) opts.windowsVerbatimArguments = true @@ -49,6 +50,7 @@ function explore (args, cb) { ) } + log.silly('explore', {sh, shellArgs, opts}) var shell = spawn(sh, shellArgs, opts) shell.on('close', function (er) { // only fail if non-interactive. |