import type { Context } from "@steve.kite/stdlib"; /** * Remembers the process groups we started so shutdown can take them down. * * A background command outlives the shell that launched it, so a group has to * stay reapable long after its leader is gone. * * A group is identified by the number the operating system gave it, and that * number is reused once the group is gone. Every group is therefore dropped as * soon as it dies, and checked again immediately before it is signalled, which * narrows the window in which a recycled identifier could be mistaken for ours * to the gap between that check and the signal. Closing it entirely would take * a kernel handle on the group, which the platforms we support do not offer. */ export declare class ProcessGroupReaper { #private; retain(processGroupId: number): void; release(processGroupId: number): void; /** The groups we would take down right now, for tests and diagnostics. */ pending(): readonly number[]; /** Asks every surviving group to stop, then forces the ones that did not. */ terminateAll(ctx: Context, forceAfterMs: number): Promise; } /** * Signals a whole process group and nothing else. * * Unlike killing a process tree, there is deliberately no fall back to the bare * identifier: if the group is gone, the number may now belong to an unrelated * process, and signalling it would be someone else's problem. */ export declare function killProcessGroup(ctx: Context, processGroupId: number, signal: NodeJS.Signals): Promise; export declare function isProcessGroupAlive(processGroupId: number): boolean;