Skip to main content

Module exec

Module exec 

Source
Expand description

Command execution with separate stdout/stderr capture, CRLF normalisation, and a per-stream truncation cap.

The cap is “200 lines or 8KB, whichever comes first” per stream. We normalise CRLF to LF before counting lines so the output is consistent across platforms. The single truncated flag in ExecOutcome is true if either stream was clipped.

Structs§

ExecOptions
Knobs for a single execution.
ExecOutcome
Result of running a single command.

Enums§

ExecError

Constants§

DEFAULT_TIMEOUT
Hard wall-clock cap for any single command. Exceeding this returns a truncated result with whatever output has been gathered so far.
MAX_BYTES_PER_STREAM
Per-stream output cap (bytes). Counted on the post-CRLF-normalised stream.
MAX_LINES_PER_STREAM
Per-stream output cap (lines). Counted after CRLF normalisation.

Functions§

cwd_label
Helper used by integration tests and shell_describe to surface the resolved command directory as a string.
execute
Execute the given tokens. The first token is the program; the rest are passed as discrete arguments — no shell is invoked, which is why the metacharacter rejection in crate::safety is a hard prerequisite.