diff --git a/scripts/smoke.mjs b/scripts/smoke.mjs index 534d1a9..c0f82c3 100644 --- a/scripts/smoke.mjs +++ b/scripts/smoke.mjs @@ -23,8 +23,12 @@ const port = await freePort() const chrome = spawn(chromePath, [ '--headless=new', `--remote-debugging-port=${port}`, `--user-data-dir=${dir}`, '--no-sandbox', '--disable-gpu', '--no-first-run', 'about:blank', -], { stdio: 'ignore' }) -const cleanup = () => { chrome.kill('SIGKILL'); rmSync(dir, { recursive: true, force: true }) } +], { stdio: 'ignore', detached: true }) +// Chrome forks helper processes; kill the whole process group, then remove the profile dir. +const cleanup = () => { + try { process.kill(-chrome.pid, 'SIGKILL') } catch {} + rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }) +} const finish = (code, msg) => { if (msg) console.log(msg); cleanup(); process.exit(code) } process.on('SIGINT', () => finish(1, 'interrupted')) const timer = setTimeout(() => finish(1, 'FAIL: timed out'), 30000)