Skip to main content

Module exec

Module exec 

Source
Expand description

Streaming exec engine: a running command in a sailbox with live output.

ExecProcess::start opens a server-streaming exec request. The first frame reports that the command has started (carrying the durable exec_request_id); chunk frames carry live stdout/stderr; a terminal 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 fetching the authoritative buffered result. Stdin rides a separate offset-idempotent unary request, independent of the output stream.

Structs§

AsyncStreamReader
An async cursor over one live output stream, the awaiting counterpart of StreamReader. AsyncStreamReader::next yields the next chunk without parking a runtime thread, so many streams can be read on one event loop.
ExecOptions
Optional settings for Sailbox::exec and Sailbox::exec_shell. Default runs a plain foreground command (no pty, no stdin, no timeout) and retries transient failures against a waking or migrating sailbox for 30 seconds (see retry_timeout).
ExecProcess
A handle to a running command. Drop or ExecProcess::close releases the stream without killing the command.
ExecResult
The buffered result of a finished exec.
StreamReader
A cursor over one live output stream. StreamReader::next blocks up to a timeout for the next chunk.

Enums§

CancelSignal
Which signal to send when cancelling a running exec.
OutputStream
Which output stream a chunk or reader belongs to.
ReadStep
One step of reading a live output stream.
RetryBudget
How long to keep retrying transient RPCs against a waking or migrating sailbox before giving up.