Skip to main content

Module proc

Module proc 

Source
Expand description

Running external commands.

Two things here are load bearing. First, both output streams are captured on their own threads: an agent CLI can emit megabytes of JSONL, and reading one pipe to completion before the other deadlocks as soon as the unread pipe fills. Second, a failure message shows both streams, because one agent CLI reports fatal conditions on stdout with stderr empty, and another writes routine chatter to stderr on every run.

Structs§

ExecOpts
Output

Constants§

DEFAULT_TIMEOUT_SECS

Functions§

abbreviate
Prompts run to many kilobytes. Echoing them whole buries the actual error.
exec
Run a command to completion, capturing both streams.
expand_tilde
Expand a leading ~ against $HOME. Nothing else: a config path is not a shell word and should not behave like one.
failure_message
Both streams, labelled. Preferring stderr is not enough: one agent CLI writes chatter like “Reading additional input from stdin…” to stderr on every run, which outranks the real reason and explains nothing, while another reports fatal conditions on stdout with stderr empty.
home_dir
is_executable
run
Run a command and return stdout. With check set, a non-zero exit is an error carrying both streams.
run_str
Convenience for the many run(&["git".into(), ...]) call sites.
which
Whether a program is on PATH.