TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
Cmd type represents a command to be run on a sprite. Its API mirrors os/exec.Cmd for familiarity: set fields to configure the command, then call Run to execute it synchronously, Start/Wait for asynchronous control, or Output/CombinedOutput to capture output. Obtain a *Cmd by calling sprite.Command or sprite.CommandContext. You can also attach to an existing session with sprite.AttachSession.
Fields
Path or name of the command to run (e.g.,
"python", "/usr/bin/node"). Set automatically by sprite.Command.Command-line arguments including the command as
Args[0]. Set automatically by sprite.Command.Environment variables for the process in
"KEY=VALUE" form. If nil, the process uses the current environment.Working directory for the command. If empty, the command runs in the sprite’s default directory.
Standard input for the process. If nil, the process reads from the null device. Set before calling
Start; use StdinPipe for streaming input.Standard output destination. If nil, output goes to the null device. Set before calling
Start; use StdoutPipe for streaming output.Standard error destination. If nil, output goes to the null device. Set before calling
Start; use StderrPipe for streaming error output.Optional callback invoked when text (out-of-band) messages are received from the server, such as port-open/close notifications. The handler receives the raw JSON message bytes.
Execution
Run
Start followed by Wait. Returns a *ExitError if the command exits with a non-zero status.
Nil on success.
*ExitError if the process exited with a non-zero code. Other errors for connection or I/O failures.Start
Wait to collect the result. Returns an error if the command has already been started. Pipes must be set up before calling Start.
Non-nil if the command could not be started or has already been started.
Wait
Start. Returns ErrNotStarted if Start was never called.
Nil on success.
*ExitError for non-zero exit codes. ErrNotStarted if Start was not called. "connection closed" if the remote connection was lost.Output
Stdout has already been set.
Captured standard output.
Non-nil on failure.
*ExitError for non-zero exit codes.CombinedOutput
Stdout or Stderr has already been set.
Interleaved standard output and standard error.
Non-nil on failure.
Pipes
StdinPipe
Start. Returns an error if Stdin is already set or the command has started.
Write end of the stdin pipe. Close it to signal EOF to the process.
Non-nil if
Stdin is already set or the command has already started.StdoutPipe
Start. Returns an error if Stdout is already set or the command has started.
Read end of the stdout pipe.
Non-nil if
Stdout is already set or the command has already started.StderrPipe
Start. Returns an error if Stderr is already set or the command has started.
Read end of the stderr pipe.
Non-nil if
Stderr is already set or the command has already started.TTY
SetTTY
Start. Panics if called after the process has started.
Pass
true to run the command with a PTY attached.SetTTYSize
Start, sets the initial size. If called after Start while the process is running, resizes the live terminal. Requires TTY mode to be enabled with SetTTY(true).
Terminal height in rows.
Terminal width in columns.
Non-nil if TTY mode is not enabled or the command is not initialized.
Resize
Start and before the command exits.
New terminal height in rows.
New terminal width in columns.
Non-nil if the command has not started, TTY mode is not enabled, or the command has finished.
Signals
Signal
X-Sprite-Capabilities header, the signal is sent over the existing WebSocket. Otherwise it falls back to an HTTP POST. Must be called after Start and before the process exits.
Valid signal names: INT, TERM, HUP, KILL, QUIT, USR1, USR2.
Signal name to send (e.g.,
"TERM", "INT").Non-nil if the command has not started, has already finished, or no session ID is available for the HTTP fallback.
Inspection
ExitCode
-1 if the process has not yet exited or was terminated abnormally.
Exit code, or
-1 if not yet exited.ConnectionMode
Start has been called. Returns "control" for multiplexed control connections, "direct" for per-request WebSocket connections, or "" if Start has not been called yet.
"control", "direct", or "".String
"python [-c print(2+2)]"). Returns "<nil>" if called on a nil pointer.
Human-readable command description.
Error types
ExitError
Run, Wait, Output, and CombinedOutput when the command exits with a non-zero status.
The exit status code from the remote process.
"exit status N".
e.Code.
ErrNotStarted
Wait when called before Start.