ttsc
Version:
General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.
27 lines (26 loc) • 1.37 kB
TypeScript
export interface CapturedProcessOutput {
/** Close the descriptors and remove the backing files. */
dispose(): void;
/** Read one stream's bytes, decoded unless `"buffer"` is asked for. */
read(stream: "stdout" | "stderr", encoding: BufferEncoding | "buffer" | undefined): string | Buffer;
stderrFd: number;
stdoutFd: number;
}
/**
* A pair of temporary files standing in for a child process's pipes.
*
* `spawnSync` holds a _piped_ stream in this process's memory and refuses to
* keep more than `maxBuffer` bytes, so any piped capture has to name a ceiling
* — and a ceiling is a number nobody chose for this machine, deciding on the
* user's behalf that a large but legitimate build said too much. Handing the
* child a file descriptor instead means the bytes never pass through this heap
* on their way out of the child: how much a process may write is the
* filesystem's business, and that is the same answer on every machine. Reading
* the result back still materializes a string, so V8's own maximum string
* length remains the outer bound — but that is a property of the runtime rather
* than a budget chosen here, and it is identical everywhere this runs.
*
* The directory is per-call, so two concurrent spawns cannot read each other's
* bytes.
*/
export declare function captureProcessOutput(): CapturedProcessOutput;