Type Alias: ChildProcessResult
ChildProcessResult =
ChildProcess&Promise<ExecResult>
What spawn returns: the LIVE ChildProcess handle that is ALSO a
Promise<ExecResult> resolving on exit.
This is additive - the object still satisfies Promise<ExecResult>, so every
existing await spawn(...) / spawn(...).then(...) caller is unchanged. What
is new is that the same value is the live child: callers that want to supervise
it can read .pid, call .kill(signal), and listen for exit without a
second spawn.
Examples
Section titled “Examples”Await it (unchanged)const { stdout } = await spawn("git", ["rev-parse", "HEAD"], { stdout: "capture" });Supervise itconst proc = spawn("bun", ["src/server.ts"]);const shutdown = () => kill(proc);const { exitCode } = await proc;