/** * Process groups of the tools this process started (T12963). * * The tool cache starts every tool detached, in its own process group, so a * deadline can signal the whole tree. The flip side: when cleo itself dies, * nothing reaches that group. A SIGKILLed `cleo verify tool:test` can leave * its test runner running with PPID 1, so a slot is not free just because its * holder pid is gone. Every slot this process holds therefore records the * groups started while it is held, and a slot is reaped only once both its * holder pid and those groups are gone. * * @task T12963 */ /** * Whether `id` may ever be probed as a pid or process group: an integer above * 1. Never 0 (our own group), 1 (init) or a negative number (`kill(-1)` * reaches every process we own). * * @param id - Candidate pid or pgid. * @returns `true` when it is safe to probe. * * @task T12963 */ export declare function isProbeableId(id: unknown): id is number; /** * Register a tool's process group as running. Every slot this process holds * is told, so its holder record lists the group. A no-op on Windows (no POSIX * process groups) and for an id that is not probeable. * * @param pgid - The group id: the pid of a child spawned with `detached: true`. * @returns Marks the group as no longer running (idempotent). Every slot this * process holds is told, so its record drops the group: a finished group id * that the system later reuses never keeps a dead holder's charge (T14066). * * @task T12963 * @task T14066 */ export declare function trackToolGroup(pgid: number | undefined): () => void; /** * Process groups this process started that have not finished yet. * * @returns Group ids, oldest first. * * @task T12963 */ export declare function activeToolGroups(): number[]; /** * Follow the tool groups running while a slot is held: seeded with the groups * already running, then `onChange` is called with the full list each time one * starts or finishes. * * @param onChange - Called with every group still running, after each change. * @returns The groups running now (kept up to date) and `stop`. * * @task T12963 * @task T14066 */ export declare function followToolGroups(onChange: (groups: readonly number[]) => void): { groups: readonly number[]; stop: () => void; }; /** * Whether a process group still has a member, by `kill(-pgid, 0)` (signal 0 * sends nothing). * * @param pgid - Group id. * @returns `gone` (ESRCH), `alive` (exists, EPERM included), or `unknown` * when the id is not probeable or the probe failed some other way. * * @task T12963 */ export declare function probeProcessGroup(pgid: number): 'gone' | 'alive' | 'unknown'; /** * Forget every tracked group and listener. Tests only. * @internal */ export declare function _resetToolGroupsForTest(): void; //# sourceMappingURL=tool-groups.d.ts.map