Skip to content
Myr

Small refactoring of joinCommand() (#244)

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 f488c42 · Browse files · 1 file+4 added−6 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+4 added−6 removed

  • other:+4 added−6 removed

1 file+4 added−6 removed

modified:index.js+4 added-6 removed
229 unmodified lines
230231 return `failed with exit code ${exitCode} (${exitCodeName})`;232}233234function joinCommand(command, args) {235 let joinedCommand = command;236237 if (Array.isArray(args) && args.length > 0) {238 joinedCommand += ' ' + args.join(' ');234function joinCommand(command, args = []) {235 if (!Array.isArray(args)) {236 return command;237 }238241 return joinedCommand;239 return [command, ...args].join(' ');240}241242const execa = (command, args, options) => {243 const parsed = handleArgs(command, args, options);
214 unmodified lines