Skip to content

Classes

Commands

sbx.commands: run commands in the sandbox.

new Commands(sbx): Commands

Sandbox

Commands

connect(pid): Promise<CommandHandle>

A handle to a background command by pid.

number

Promise<CommandHandle>


kill(pid): Promise<boolean>

SIGKILL a background command (and its process group). Resolves false if it had already exited.

number

Promise<boolean>


list(): Promise<ProcessInfo[]>

Background commands started in this sandbox (running and finished).

Promise<ProcessInfo[]>


run(cmd, opts): Promise<CommandHandle>

Run a command and wait for it. cmd is a string (run with bash, so shell syntax works) or an argv array (no shell). Rejects with CommandExitError on a non-zero exit, TimeoutError after timeoutMs, FileNotFoundError if cwd is missing. With background: true, resolves with a CommandHandle as soon as it starts.

string | string[]

CommandStartOpts & object

Promise<CommandHandle>

run(cmd, opts?): Promise<CommandResult>

Run a command and wait for it. cmd is a string (run with bash, so shell syntax works) or an argv array (no shell). Rejects with CommandExitError on a non-zero exit, TimeoutError after timeoutMs, FileNotFoundError if cwd is missing. With background: true, resolves with a CommandHandle as soon as it starts.

string | string[]

CommandStartOpts & object

Promise<CommandResult>