Skip to content

Commit

Permalink
Small refactoring of joinCommand() (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored and sindresorhus committed May 14, 2019
1 parent f488c42 commit 8ca5dcb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions index.js
Expand Up @@ -231,14 +231,12 @@ function getErrorPrefix({timedOut, timeout, signal, exitCodeName, exitCode, isCa
return `failed with exit code ${exitCode} (${exitCodeName})`;
}

function joinCommand(command, args) {
let joinedCommand = command;

if (Array.isArray(args) && args.length > 0) {
joinedCommand += ' ' + args.join(' ');
function joinCommand(command, args = []) {
if (!Array.isArray(args)) {
return command;
}

return joinedCommand;
return [command, ...args].join(' ');
}

const execa = (command, args, options) => {
Expand Down

0 comments on commit 8ca5dcb

Please sign in to comment.