From c3897b4a633173acbcaeaf0b1211929f031dfe8d Mon Sep 17 00:00:00 2001 From: garrytan Date: Fri, 2 Oct 2026 20:28:04 +0000 Subject: [PATCH] test(browse): group-kill cleanup falls back to the leader when macOS returns EPERM for a live group --- browse/test/chromium-profile-isolation.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/browse/test/chromium-profile-isolation.test.ts b/browse/test/chromium-profile-isolation.test.ts index 21269ee0c..d35eda405 100644 --- a/browse/test/chromium-profile-isolation.test.ts +++ b/browse/test/chromium-profile-isolation.test.ts @@ -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; + } } }