Skip to main content
The Go SDK exposes stdio through sandbox.Stdio. Use Stdio.Start() to launch a process with an open stdin pipe, then send data, receive output, and close stdin or kill the process. For conceptual background see the Stdio feature overview.

sandbox.Stdio.Start(ctx, cmd, opts)(*StdioHandle, error)

Start a subprocess with an open stdin pipe.

StdioStartOpts

Pass nil for opts to use all defaults.

StdioHandle

Handle for an interactive subprocess with stdin pipe.

Fields

  • handle.CmdID string — server-assigned command identifier.

Methods

handle.SendStdin(ctx, data) error

Send data to the process’s stdin. Data is []byte.

handle.CloseStdin(ctx) error

Close the process’s stdin pipe, sending EOF.

handle.Kill(ctx) error

Terminate the process.

handle.Wait(ctx) (*StdioResult, error)

Block until the process exits. Equivalent to calling Stream with no callbacks.

handle.Stream(ctx, opts) (*StdioResult, error)

Connect to the SSE output stream and deliver stdout/stderr chunks via callbacks. Blocks until the process exits or the context is cancelled.

StdioStreamOpts

Pass nil for opts to drain the stream without callbacks (same as Wait).

StdioResult

ExitCode is -1 if the stream ended without a clean exit frame.