Skip to content
Myr

Improve `execa.shell()` and remove dead code (#181)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by Sindre Sorhus · parent f309669 · Browse files · 1 file+2 added−35 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−35 removed

  • other:+2 added−35 removed

1 file+2 added−35 removed

modified:index.js+2 added-35 removed
12 unmodified lines
1314const TEN_MEGABYTES = 1000 * 1000 * 10;1516function handleArgs(command, args, options) {17 let parsed;1817 options = Object.assign({18 extendEnv: true,19 env: {}20 }, options);
1 unmodified line
22 if (options.extendEnv) {23 options.env = Object.assign({}, process.env, options.env);24 }2528 if (options.__winShell === true) {29 delete options.__winShell;30 parsed = {31 command,32 args,33 options,34 file: command,35 original: {36 command,37 args38 }39 };40 } else {41 parsed = crossSpawn._parse(command, args, options);26 const parsed = crossSpawn._parse(command, args, options);42 }2728 options = Object.assign({29 maxBuffer: TEN_MEGABYTES,30 buffer: true,
54 unmodified lines
85 return value;86}8788function handleShell(fn, command, options) {105 let file = '/bin/sh';106 let args = ['-c', command];107108 options = Object.assign({}, options);109110 if (process.platform === 'win32') {111 options.__winShell = true;112 file = process.env.comspec || 'cmd.exe';113 args = ['/s', '/c', `"${command}"`];114 options.windowsVerbatimArguments = true;115 }116117 if (options.shell) {118 file = options.shell;119 delete options.shell;120 }121122 return fn(file, args, options);89 return fn(command, Object.assign({}, options, {shell: true}));90}9192function getStream(process, stream, {encoding, buffer, maxBuffer}) {93 if (!process[stream]) {
244 unmodified lines