Expand description
Streaming exec engine: a running command in a sailbox with live output.
ExecProcess::start opens the worker proxy’s server-streaming
StreamSailboxExec RPC. The first frame is Started (carrying the durable
exec_request_id); chunk frames carry live stdout/stderr; a terminal Exit
frame carries the result. The command is detached on the server, so dropping
the handle never kills it.
A background pump task drains the stream into two drop-oldest ring buffers
that synchronous readers (StreamReader) pull from. If the stream breaks
mid-run, the pump reconnects with the same idempotency key and the per-stream
seqs it last saw, so the guest replays only the unseen tail. Only when the
stream cannot be resumed does ExecProcess::wait fall back to polling
WaitSailboxExec for the authoritative buffered result. Stdin rides a
separate offset-idempotent unary RPC, independent of the output stream.
Structs§
- Async
Stream Reader - An async cursor over one live output stream, the awaiting counterpart of
StreamReader.AsyncStreamReader::nextyields the next chunk without parking a runtime thread, so many streams can be read on one event loop. - Exec
Options - Optional settings for
Sailbox::execandSailbox::exec_shell.Defaultruns a plain foreground command (no pty, no stdin, no timeout) and retries transient failures against a waking or migrating sailbox for 30 seconds (seeretry_timeout). - Exec
Process - A handle to a running command. Drop or
ExecProcess::closereleases the stream without killing the command. - Exec
Result - The buffered result of a finished exec.
- Stream
Reader - A cursor over one live output stream.
StreamReader::nextblocks up to a timeout for the next chunk.
Enums§
- Cancel
Signal - Which signal to send when cancelling a running exec.
- Output
Stream - Which output stream a chunk or reader belongs to.
- Read
Step - One step of reading a live output stream.
- Retry
Budget - How long to keep retrying transient RPCs against a waking or migrating sailbox before giving up.
Constants§
- EXEC_
TRANSIENT_ RETRY_ TIMEOUT_ SECONDS - Default budget for transient-RPC retries against a waking/migrating sailbox;
the default value of
ExecOptions::retry_timeout.
Functions§
- shell_
argv - Build the
argvthat runscommandvia/bin/sh -lc, applying thecwd/backgroundshell conveniences fromoptionsand validating their combinations. This is the single implementation behind every SDK’s string-command exec.