From 7d1329ffa5d4736ffc4c586214bb041a4955496a Mon Sep 17 00:00:00 2001 From: Jean-Charles Sisk Date: Fri, 7 Feb 2020 14:35:12 -0800 Subject: [PATCH] fix: npm explore spawn shell correctly PR-URL: https://github.com/npm/cli/pull/784 Credit: @jasisk Close: #784 Reviewed-by: @isaacs --- lib/explore.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/explore.js b/lib/explore.js index 0c9930f8e4ca7..32c93d6553ac9 100644 --- a/lib/explore.js +++ b/lib/explore.js @@ -23,14 +23,13 @@ function explore (args, cb) { var opts = {cwd: cwd, stdio: 'inherit'} var shellArgs = [] - if (args) { + if (args.length) { if (isWindows) { var execCmd = escapeExecPath(args.shift()) var execArgs = [execCmd].concat(args.map(escapeArg)) opts.windowsVerbatimArguments = true shellArgs = ['/d', '/s', '/c'].concat(execArgs) } else { - shellArgs.unshift('-c') shellArgs = ['-c', args.map(escapeArg).join(' ').trim()] } }