Sandbox. See Commands for usage examples.
Typical flow
Run and collect
sandbox.exec()
Example
Example
execStream() instead.
Parameters
cmdstring“python3”, “/usr/bin/node”).args?Iterable<string>[“-c”, “print(‘hello’)”]).Returns
sandbox.execWith()
Example
Example
Parameters
cmdstringReturns
sandbox.shell()
Example
Example
/bin/sh). Shell syntax like pipes, redirects, and && chains works.
Parameters
scriptstring“ls -la /app && echo done”).Returns
sandbox.attachShell()
Example
Example
Returns
Stream and attach
sandbox.execStream()
Example
Example
Parameters
cmdstringargs?Iterable<string>Returns
sandbox.execStreamWith()
Example
Example
execWith(): same configuration via ExecOptionsBuilder, but returns an ExecHandle instead of buffering output. For sessions configured with .tty(true), call resize(rows, cols) when the terminal dimensions change.
Parameters
cmdstringReturns
sandbox.shellStream()
Example
Example
Parameters
scriptstringReturns
sandbox.attach()
Example
Example
Ctrl+] (or configured detach keys) to disconnect without stopping the process.
Parameters
cmdstringargs?Iterable<string>Returns
sandbox.attachWith()
Example
Example
Parameters
cmdstringReturns
Types
ExecOutput
Returned by exec() · execWith() · shell() · ExecHandle.collect()
The result of a completed command execution: collected output plus exit status. In TTY mode,stdoutBytes() contains the combined terminal output and stderrBytes() is empty because a PTY doesn’t preserve separate stdout and stderr streams.
ExecHandle
Returned by execStream() · execStreamWith() · shellStream()
A handle to a running streaming execution. ImplementsAsyncIterable<ExecEvent> and AsyncDisposable, so it works with for await...of and await using. signal(), kill(), and resize() may run while another task is waiting in recv(); concurrent receive, wait, and collect operations are not supported.
ExecSink
Returned by ExecHandle.takeStdin()
Writer for sending data to a running process’s stdin. ImplementsAsyncDisposable. Obtained from ExecHandle.takeStdin() when the execution was configured with .stdinPipe().
ExecEvent
Emitted by ExecHandle
Discriminated union emitted while iterating anExecHandle. The discriminator is kind.
ExitStatus
Returned by ExecHandle.wait() · ExecOutput.status
The exit result of a process.ExecOptionsBuilder
Used by execWith() · execStreamWith()
Fluent builder passed to the callback inexecWith(cmd, b => ...) and execStreamWith(cmd, b => ...). Every setter mutates the builder and returns it, so calls chain.
AttachOptionsBuilder
Used by attachWith()
Fluent builder passed to the callback inattachWith(cmd, b => ...). Every setter mutates the builder and returns it, so calls chain.
Stdin
Produces StdinMode
Helper factory for constructing aStdinMode. Equivalent to the stdinNull / stdinPipe / stdinBytes setters on ExecOptionsBuilder.
StdinMode
Produced by Stdin
Discriminated union describing stdin behavior for an execution.Rlimit
Set via ExecOptionsBuilder.rlimit() · AttachOptionsBuilder.rlimit()
A POSIX resource limit applied to the process.RlimitResource
Used by Rlimit.resource · rlimit() · rlimit()
String union naming a limitable POSIX resource.