Skip to content

Commit 4d82803

Browse files
authored
feat: expose exitcode in error instance (#9)
1 parent bb19cda commit 4d82803

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ module.exports = function runScript(script, options, extraOptions) {
9696
const err = new Error(`Run "${sh} ${shFlag} ${script}" error, exit code ${code}`);
9797
err.name = 'RunScriptError';
9898
err.stdio = stdio;
99+
err.exitcode = code;
99100
return reject(err);
100101
}
101102
return resolve(stdio);

test/runscript.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('test/runscript.test.js', () => {
2323
.catch(err => {
2424
console.log(err);
2525
assert(err.name === 'RunScriptError');
26+
assert(err.exitcode === 255);
2627
});
2728
});
2829

0 commit comments

Comments
 (0)