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§
Constants§
- DEFAULT_
TIMEOUT_ SECS - How long one agent call may run before it is killed.
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 - interrupted
- Whether the process has been told to stop.
- is_
executable - run
- Run a command and return stdout. With
checkset, a non-zero exit is an error carrying both streams. - run_
bytes - Run a command and return stdout without changing non-UTF-8 bytes.
- run_str
- Convenience for the many
run(&["git".into(), ...])call sites. - sleep_
unless_ interrupted - Sleep for
total, waking early if the process is told to stop. True when it woke early. - stop_
on_ signal - Turn SIGINT and SIGTERM into a flag that running commands and idle sleeps check, instead of the default action that ends the process where it stands.
- which
- Whether a program is on PATH.