Skip to content

Commit

Permalink
Reorder properties of results and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 13, 2019
1 parent 943f040 commit df4c060
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions index.js
Expand Up @@ -181,24 +181,25 @@ function makeError(result, options) {
error = new Error(message);
}

error.code = exitCode || exitCodeName;
error.command = joinedCommand;
error.exitCode = exitCode;
error.exitCodeName = exitCodeName;
error.code = exitCode || exitCodeName;
error.stdout = stdout;
error.stderr = stderr;
error.failed = true;
// `signal` emitted on `spawned.on('exit')` event can be `null`. We normalize
// it to `undefined`
error.signal = signal || undefined;
error.command = joinedCommand;
error.timedOut = timedOut;
error.isCanceled = isCanceled;
error.killed = killed && !timedOut;

if ('all' in result) {
error.all = result.all;
}

error.failed = true;
error.timedOut = timedOut;
error.isCanceled = isCanceled;
error.killed = killed && !timedOut;
// `signal` emitted on `spawned.on('exit')` event can be `null`. We normalize
// it to `undefined`
error.signal = signal || undefined;

return error;
}

Expand Down Expand Up @@ -372,17 +373,17 @@ const execa = (command, args, options) => {
}

return {
command: joinedCommand,
exitCode: 0,
exitCodeName: 'SUCCESS',
code: 0,
stdout: result.stdout,
stderr: result.stderr,
all: result.all,
code: 0,
exitCode: 0,
exitCodeName: 'SUCCESS',
failed: false,
killed: false,
command: joinedCommand,
timedOut: false,
isCanceled: false
isCanceled: false,
killed: false
};
};

Expand Down Expand Up @@ -444,15 +445,15 @@ module.exports.sync = (command, args, options) => {
}

return {
stdout: result.stdout,
stderr: result.stderr,
code: 0,
command: joinedCommand,
exitCode: 0,
exitCodeName: 'SUCCESS',
code: 0,
stdout: result.stdout,
stderr: result.stderr,
failed: false,
killed: false,
command: joinedCommand,
timedOut: false,
isCanceled: false
isCanceled: false,
killed: false
};
};

0 comments on commit df4c060

Please sign in to comment.