UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

30 lines • 1.69 kB
import type { ChildProcess } from "node:child_process"; export interface WaitForChildProcessOptions { /** * Abort when the caller has killed the process and no longer needs its * output. The wait then stops preserving stdio tails (descendants that * survived the kill can no longer hold it open) and resolves as soon as * the process exits, or after `abortExitGraceMs` if it never does. */ signal?: AbortSignal; /** Post-abort deadline for `exit` before resolving anyway. Default 5s. */ abortExitGraceMs?: number; } /** * Wait for a child process to terminate without hanging on inherited stdio handles. * * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr * pipe open. We must not resolve and destroy the streams on a fixed deadline measured * from `exit`, or output still being written past that deadline is silently lost * (earendil-works/pi#5303). Instead, after `exit` we wait for the pipes to fall idle: * the grace timer is re-armed on every chunk, so an actively writing descendant keeps * us reading, while a quiet inherited handle (e.g. a Windows daemonized descendant * that never lets `close` fire) still releases us after the grace elapses. * * When `options.signal` aborts, the caller has killed the process and * abandoned its output: tail preservation ends, the pipes are destroyed, and * the wait resolves on `exit` — or after `abortExitGraceMs` when the kill * never lands (uninterruptible IO, failed taskkill). */ export declare function waitForChildProcess(child: ChildProcess, options?: WaitForChildProcessOptions): Promise<number | null>; //# sourceMappingURL=wait-child.d.ts.map