chrome guard: a zombie counts as ended (an orphan's new parent in a container whose PID 1 is no init never reaps it, and kill(pid, 0) still succeeds), so the reaper reports it and the real-process test passes on the Linux runner
This commit is contained in:
parent
c3b1e8c370
commit
cdaecc2afb
2 changed files with 11 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
|||
// standing in for Chrome (sh + sleep, no browser, about a second): the watchdog ends the child when its parent dies and
|
||||
// never touches a reused pid; the reaper ends a real orphan with a storebound profile on its command line.
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { guardChrome, guardedPids, isOrphan, parsePs, reapStaleChromes, staleChromes, startWatchdog, userDataDirOf, watchdogArgv } from '../cli/console/chrome-guard';
|
||||
import { guardChrome, guardedPids, isOrphan, isZombie, parsePs, reapStaleChromes, staleChromes, startWatchdog, userDataDirOf, watchdogArgv } from '../cli/console/chrome-guard';
|
||||
import { persistentExecutable } from '../cli/shots/browser';
|
||||
import * as rt from '../cli/lib/rt';
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ describe('headless runs on macOS never use Google Chrome.app when another Chromi
|
|||
// ---- real processes (sh + sleep stand in for Chrome and its run) ----
|
||||
|
||||
const posix = process.platform !== 'win32';
|
||||
const alive = (pid: number) => { try { process.kill(pid, 0); return true; } catch { return false; } };
|
||||
const alive = (pid: number) => { try { process.kill(pid, 0); } catch { return false; } return !isZombie(pid); };
|
||||
async function until(what: string, ok: () => boolean, ms = 5000): Promise<void> {
|
||||
const end = Date.now() + ms;
|
||||
while (!ok()) { if (Date.now() > end) throw new Error(`timed out after ${ms} ms waiting for: ${what}`); await rt.sleep(50); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue