interface ChromeHandle

Handles to a pre-launched Chrome, available synchronously the moment it is spawned — before the CDP endpoint is known. Enough to reap the process and its temp dir, which is all the process.on('exit') safety net and shutdownPrelaunch() need.

// Defined, not invoked: real handles come from Chrome.spawn / the prelaunch.
async function reap(chrome: ChromeHandle) {
  await chrome.shutdown(); // safe before CDP is ready, idempotent after
}

Properties

proc: ChildProcess

The spawned Chrome child process.

shutdown: () => Promise<void>

Kills Chrome and awaits async temp-dir cleanup. Safe to call before CDP is ready, and idempotent with Chrome's own dead-on-arrival cleanup. Call before process.exit().

Usage

import { type ChromeHandle } from "lib/types.ts";