Skip to content

Commit

Permalink
Suppress EPERM when killing child processes
Browse files Browse the repository at this point in the history
This is the signal OS X throws when trying to kill a process group where
the pid has already stopped
  • Loading branch information
airhorns committed Jul 20, 2023
1 parent abf9ecf commit 36b16c6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ export class Supervisor extends EventEmitter {
try {
process.kill(-pid, signal);
} catch (error: any) {
if (error.code == "ESRCH") {
// process can't be found, is already dead
return;
if (error.code == "ESRCH" || error.code == "EPERM") {
// process can't be found or can't be killed again, its already dead
} else {
throw error;
}
Expand Down

0 comments on commit 36b16c6

Please sign in to comment.