Skip to content

Function: spawn()

spawn(…args): ChildProcessResult

Spawn a subprocess. Returns the LIVE child handle that is ALSO a Promise<ExecResult> resolving on exit - see ChildProcessResult.

The promise half is the exact behaviour this function had before: it awaits exit (and any line reads / stdin write), then resolves to the ExecResult or rejects (spawn error other than a missing executable, or check on non-zero exit). Existing await spawn(...) callers are unaffected. The handle half lets a caller supervise the process (.pid, .kill(signal), exit event) without a second spawn - e.g. @dbx-tools/appkit’s bindProcess.

SpawnArgs<ExecOptions>

Arguments passed verbatim to the executable

ChildProcessResult

The live ChildProcess, awaitable to exit code + captured output

(on the promise) When spawn fails for a reason other than a missing executable, line reads fail, or check is true and exit code is non-zero