Skip to content

Commit

Permalink
fix: Cancel child processes only when reporting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed Apr 1, 2023
1 parent 12dfd2c commit 4208deb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export async function execa(cmd: string[]) {
});

// Prevent accidental exit
global.addEventListener("beforeunload", () => {
globalThis.addEventListener("error", () => {
childExit();
});

globalThis.addEventListener("unhandledrejection", () => {
childExit();
});

Expand Down

0 comments on commit 4208deb

Please sign in to comment.