Skip to content
1 min read · 174 words

Interface: BinaryExecutor ​

Defined in: src/batteries/media/contracts.ts:177

Runs a binary invocation to completion. How and where it runs — local child process, remote runner, sandbox, container, a browser-side WASI shim — is the implementation's business.

Methods ​

exec() ​

ts
exec(invocation: BinaryInvocation): Promise<BinaryExecResult>;

Defined in: src/batteries/media/contracts.ts:193

Run one invocation to completion and report the result. Implementations must not throw on non-zero exits — report via failed/exitCode so callers map failures to readable errors.

Parameters ​

ParameterTypeDescription
invocationBinaryInvocationThe command, args, working directory, environment, and limits to run.

Returns ​

Promise<BinaryExecResult>

The settled result.

Remarks ​

When invocation.signal aborts or invocation.timeoutMs elapses, an implementation MUST terminate the process it started and settle, rather than leaving it running with this promise pending. A binary that spawns children of its own is the caller's hazard: the bundled executor spawns the child as its own process-group leader and signals the WHOLE group (BinaryInvocation.killSignal, escalating to SIGKILL per BinaryInvocation.forceKillAfterDelay) so a wrapper cannot outlive the invocation.