Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2019-08-22 10:58:06 +0300
committerisaacs <i@izs.me>2019-08-22 11:04:14 +0300
commit6cc4cc66f1fb050dc4113e35cab59197fd48e04a (patch)
tree15a438700023efbff39d0bf05df0cd827e23814e /lib/explore.js
parentbf93e91d879c816a055d5913e6e4210d7299f299 (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.js6
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.