Skip to content

Commit

Permalink
Add the exit code to the error - closes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Nov 15, 2024
1 parent 2b01807 commit 1b2ccd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,12 @@ export function spawn<T = string>(
if (code === 0) {
pipesClosed.subscribe(() => subj.complete());
} else {
pipesClosed.subscribe(() =>
subj.error(new Error(`Failed with exit code: ${code}`))
);
pipesClosed.subscribe(() => {
const e: any = new Error(`Failed with exit code: ${code}`);
e.exitCode = code;

subj.error(e);
});
}
});

Expand Down

0 comments on commit 1b2ccd2

Please sign in to comment.