Skip to content

runProcess

runProcess(program, args, opts?): Promise<void>

Defined in: ../cli/watcher.ts:88

Runs a program with its output shown as it goes; resolves if it exited 0.

The AbortSignal pattern, in the one place it is written out: whoever owns the stop (main) holds the AbortController and passes only its signal down. Anything that waits on something else (a child process here, a timer in the watch loop) listens for abort and ends that wait, then throws Stopped, so each caller’s finally can clean up on the way out.

The program runs in its own process group so that a stop reaches what it started too (a then: is sh -c, which often starts others), and so that Ctrl-C at a terminal reaches the watcher alone, which stops everything in order instead of everything dying at once.

string

readonly string[]

string

ProcessEnv

string

AbortSignal

Promise<void>