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 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§

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 Client::exec. 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.
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.
Stream
Which output stream a chunk or reader belongs to.

Constants§

EXEC_TRANSIENT_RETRY_TIMEOUT_SECONDS
Default budget for transient-RPC retries against a waking/migrating sailbox; the default value of ExecOptions::retry_timeout.