/** * Minimal shape shared by Node's `ChildProcess` and lighter child wrappers. * `ChildProcess.kill` returns boolean; a no-arg `kill(): void` is assignable to * this wider signature, so callers can pass either. */ export interface KillableChild { readonly pid?: number | undefined; kill(signal?: NodeJS.Signals | number): boolean | void; } export interface TreeKillOptions { /** * Skip the graceful SIGTERM and go straight to SIGKILL on POSIX. Windows * always uses `taskkill /T /F` regardless (there is no graceful signal for a * process tree there). Use this for a force-escalation step invoked after a * graceful close has already timed out. Default false. */ force?: boolean | undefined; /** * POSIX graceful mode only: delay in ms before the SIGKILL backstop fires * after the initial SIGTERM. Default 2000. */ graceMs?: number | undefined; } /** * Kill a spawned process AND its descendants. * * On Windows a tool launched through a `.cmd` / cmd.exe shim (npx→node, uvx, * pnpm, a language server, …) is a grandchild of the tracked `cmd.exe` wrapper, * so a bare `child.kill()` signals only the wrapper and orphans the real * process, which then accumulates across every close/restart/idle-sleep. * `taskkill /T /F` tears down the whole tree, with a direct kill as the * fallback when spawning taskkill fails. * * POSIX sends SIGTERM then a SIGKILL backstop (graceful — the default), or * SIGKILL immediately when `force` is set. * * Accepts a minimal {@link KillableChild} so it works with both full * `ChildProcess` objects and lighter wrappers whose `kill()` takes no argument. */ export declare function treeKill(child: KillableChild, opts?: TreeKillOptions): void; //# sourceMappingURL=tree-kill.d.ts.map