Skip to content

Commit

Permalink
fix: add spawn error handling, fixes #77
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Mar 24, 2022
1 parent f8b7282 commit 73ad018
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const spawn = (
const dataHandler = (data: Buffer) => out.push(data.toString());
child.stdout!.on('data', dataHandler);
child.stderr!.on('data', dataHandler);
return new Promise<SpawnResult>(resolve => {
return new Promise<SpawnResult>((resolve, reject) => {
child.on('error', (err) => {
reject(err);
});
child.on('exit', code => {
d(`cmd ${cmd} terminated with code: ${code}`);
resolve({
Expand Down

0 comments on commit 73ad018

Please sign in to comment.