Skip to main content
BoxLite provides a streaming execution model for running commands inside boxes. Commands are executed asynchronously with separate access to stdout, stderr, and stdin streams.

Execution

boxlite.Execution

Represents a running command execution. Returned by box.exec().

Methods

Example

Streaming Output

You can stream stdout and stderr independently for real-time output processing.

Streaming with stderr

Interactive Input

Killing a Process

TTY Resizing

For executions started with tty=True, you can dynamically resize the terminal.

ExecStdout / ExecStderr

boxlite.ExecStdout / boxlite.ExecStderr

Async iterators for streaming output line by line.
Each stream can only be iterated once. After iteration, the stream is consumed.

ExecStdin

boxlite.ExecStdin

Writer for sending input to a running process.

Methods

Example

ExecResult

boxlite.ExecResult

Result of a completed execution.
The low-level Execution.wait() returns an ExecResult with exit_code only. The higher-level SimpleBox.exec() populates all four fields including stdout, stderr, and error_message.

Example

Common Patterns

Run and Capture Output

The simplest pattern for running a command and capturing its output.

Stream Large Output

For commands that produce large amounts of output, use streaming to avoid memory issues.

Pipeline Pattern

Run multiple commands in sequence, passing output between them.

Environment Variables per Execution

Pass environment variables to specific command executions.

Timeout with Kill

Implement a timeout for long-running commands.

See Also