Kills all surviving processes that reference dirPath (checked via cwd, cmdline,
and open file descriptors), then retries fs.rm() until it succeeds or a 5-second
deadline expires. Re-scans /proc on each failed rm() attempt to catch processes
that appear after the initial scan (e.g. late-forked Chrome helpers).
Resolves the Chrome/Chromium executable path. Returns a Promise for API compatibility with callers, but the resolution is synchronous.
Spawns a headless Chrome process with --remote-debugging-port=0 and resolves once the
CDP WebSocket endpoint appears on stderr. Returns null if Chrome is unavailable or fails
to start, so callers can fall back to playwright's normal chromium.launch().
Launch args passed to Chromium for both the CDP pre-launch spawn and the playwright fallback launch.
Usage
import * as mod from "lib/chrome/index.ts";