Files
sausheong 0ca0fed9f7 fix(browser): reap orphaned Chromes when parent dies hard
chromedp launches Chrome as detached subprocesses; on SIGKILL, OOM, or
any path that bypasses our cleanup chain they reparent to PID 1 and
survive indefinitely. Each launch now allocates a known harness-browser-*
user-data-dir and registers it with a single detached /bin/sh watchdog
spawned via Setsid. When the parent dies the watchdog detects stdin EOF
and pkills + rm -rfs every still-tracked path. Clean teardown untracks
the path so a later hard exit can't kill the next session sharing the
process.
2026-05-08 22:08:58 +08:00

11 lines
329 B
Go

//go:build !unix
package browser
// Stubs for platforms without POSIX pkill/sh. Windows callers fall back
// to chromedp's own teardown; hard-kill orphans are a known limitation
// there until we add a native implementation (e.g. Job Objects).
func trackDirForReaping(dir string) {}
func untrackDirForReaping(dir string) {}