Expand description
Runtime-neutral child-process execution for polling event loops.
rx-runner tags stdout/stderr lines, bounds retained output, exposes
non-blocking polling and cancellation, and reaps unfinished children on
drop. It uses only the Rust standard library.
use std::time::Duration;
use rx_runner::CommandSpec;
let mut process = CommandSpec::new("rustc").arg("--version").spawn()?;
loop {
let update = process.poll()?;
for line in update.lines {
println!("{:?}: {}", line.stream, line.text);
}
if update.exit.is_some() {
break;
}
std::thread::sleep(Duration::from_millis(20));
}Structs§
- Command
Spec - A program invocation with separate arguments and process options.
- Output
Line - One decoded child-output line.
- Process
Exit - Terminal child status.
- Process
Update - Output and optional terminal status produced by one poll.
- Running
Process - A running child process with non-blocking output/status polling.
Enums§
- Output
Stream - Child output source.
Constants§
- DEFAULT_
OUTPUT_ CAPACITY - Default number of output lines retained between polls.