Skip to content
2 min read · 360 words

Function: execaExecutor() ​

ts
function execaExecutor(options?: ExecaExecutorOptions): BinaryExecutor;

Defined in: src/batteries/media/engines/execa_executor.ts:412

Construct the bundled local-process BinaryExecutor.

Parameters ​

ParameterTypeDescription
optionsExecaExecutorOptionsThe execa resolver and defaults (timeout, kill signal/escalation, detached).

Returns ​

BinaryExecutor

A BinaryExecutor running invocations as local child processes.

Remarks ​

Termination follows the detached flag on every abort and timeout path. With detached: true (the default) it is a PROCESS-GROUP kill: the child is spawned detached (its own group leader) and killGroup — kill(-pid, killSignal) — reaches everything behind a wrapper (sandbox → shell → command). Once termination begins, settleEscalation defaults to 'wait': settlement waits until the group is empty or the one SIGKILL is sent, at most the remaining escalation delay. 'cancel' returns fastest but may leave survivors; 'poll' returns fastest and watches survivors after return with unref'd timers. Both probing modes have a narrow PGID-reuse risk between probes; wait bounds it to before return. Normal exits never wait or poll. With detached: false only the DIRECT child is signalled (subprocess.kill) and probed (process.kill(pid, 0)); all modes cancel at settlement because that child is already reaped. execa's own abort machinery still runs underneath: it kills the direct child at roughly the same moment, so the promise settles whichever mechanism wins the race — in group mode the group signal is what the WRAPPER and its grandchildren die from. execa's forceKillAfterDelay is forwarded as given so its own kill escalates identically when IT is the one that fires. The executor owns the timeout (never forwarded to execa), so every timeout terminates the group or direct child through the same escalation path. Its deadline timer stays ref'd until settlement. 0 and Infinity mean no deadline. Finite timeouts above 2,147,483,647 milliseconds also disable the deadline rather than overflowing Node's timer into an immediate kill. Negative values and NaN reject with a TypeError before spawning, as execa 9 did. Non-zero exits are DATA: reject: false keeps execa from throwing and every settlement — spawn failure, timeout, abort, non-zero exit — lands in the returned record, never a rejection. signalCode is surfaced additively when execa reports the terminating signal.