mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-10 02:30:39 +01:00
test(browse): group-kill cleanup falls back to the leader when macOS returns EPERM for a live group
This commit is contained in:
1 parent
714bbe2df3
commit
c3897b4a63
1 file changed
+8
-2
@@ -13,8 +13,14 @@ function killDaemonGroup(pid: number): void {
|
||||
process.kill(-pid, 'SIGKILL');
|
||||
} catch (err: any) {
|
||||
if (err?.code === 'ESRCH') return;
|
||||
if (err?.code === 'EPERM' && !isProcessAlive(pid)) return;
|
||||
throw err;
|
||||
if (err?.code !== 'EPERM') throw err;
|
||||
if (!isProcessAlive(pid)) return;
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL');
|
||||
} catch (leaderErr: any) {
|
||||
if (leaderErr?.code === 'ESRCH') return;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user