/** * Running a child process with a timeout, cancellation, and an output cap * * The command and arguments are passed as an array, with no shell involved — * special characters in paths and names can't be interpreted. * * The timeout actually stops the work rather than just giving up on waiting * for it: the process gets SIGTERM, and SIGKILL if it hasn't exited. */ export interface ProcessRunOptions { /** Executable: ssh, scp */ file: string; args: string[]; env?: NodeJS.ProcessEnv; timeoutMs?: number; signal?: AbortSignal; /** Data for stdin; without it stdin is closed right away */ stdin?: string | Buffer; maxOutputBytes?: number; killGraceMs?: number; } export interface ProcessRunOutcome { stdout: string; stderr: string; exitCode: number | null; /** Signal the process was killed with */ signalCode: NodeJS.Signals | null; /** We stopped the process ourselves after the timeout expired */ timedOut: boolean; /** We stopped the process ourselves via the cancellation signal */ aborted: boolean; /** Output exceeded the limit and was truncated */ truncated: boolean; durationMs: number; /** The process failed to start */ spawnError?: NodeJS.ErrnoException; } /** * Run a process and wait for it to finish. * * Never throws: every outcome, including a failed spawn, is returned in the * result descriptor. */ export declare function runProcess(options: ProcessRunOptions): Promise;