From 136987e2cfeff8476bb799f802b9563e97686d2f Mon Sep 17 00:00:00 2001 From: ehmicky Date: Mon, 4 Mar 2019 18:27:19 +0100 Subject: [PATCH] Improve `execa.shell()` and remove dead code (#181) --- index.js | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/index.js b/index.js index a64dce3d6..b4b5e340e 100644 --- a/index.js +++ b/index.js @@ -14,8 +14,6 @@ const stdio = require('./lib/stdio'); const TEN_MEGABYTES = 1000 * 1000 * 10; function handleArgs(command, args, options) { - let parsed; - options = Object.assign({ extendEnv: true, env: {} @@ -25,21 +23,7 @@ function handleArgs(command, args, options) { options.env = Object.assign({}, process.env, options.env); } - if (options.__winShell === true) { - delete options.__winShell; - parsed = { - command, - args, - options, - file: command, - original: { - command, - args - } - }; - } else { - parsed = crossSpawn._parse(command, args, options); - } + const parsed = crossSpawn._parse(command, args, options); options = Object.assign({ maxBuffer: TEN_MEGABYTES, @@ -102,24 +86,7 @@ function handleOutput(options, value) { } function handleShell(fn, command, options) { - let file = '/bin/sh'; - let args = ['-c', command]; - - options = Object.assign({}, options); - - if (process.platform === 'win32') { - options.__winShell = true; - file = process.env.comspec || 'cmd.exe'; - args = ['/s', '/c', `"${command}"`]; - options.windowsVerbatimArguments = true; - } - - if (options.shell) { - file = options.shell; - delete options.shell; - } - - return fn(file, args, options); + return fn(command, Object.assign({}, options, {shell: true})); } function getStream(process, stream, {encoding, buffer, maxBuffer}) {