rx-runner 0.1.0

Runtime-neutral process execution with bounded streaming output and cancellation
Documentation
  • Coverage
  • 100%
    30 out of 30 items documented1 out of 19 items with examples
  • Size
  • Source code size: 18.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 540.09 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • 89jobrien/rx
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 89jobrien

rx-runner

Runtime-neutral child-process execution for polling event loops. It captures stdout and stderr as tagged lines, bounds retained output, reports terminal status, supports cancellation, and reaps unfinished children on drop.

The crate uses only the Rust standard library and does not require Tokio or another async runtime.

use std::time::Duration;
use rx_runner::CommandSpec;

fn main() -> std::io::Result<()> {
    let mut process = CommandSpec::new("cargo")
        .args(["check", "--workspace"])
        .current_dir("/path/to/project")
        .spawn()?;

    loop {
        let update = process.poll()?;
        for line in update.lines {
            println!("{:?}: {}", line.stream, line.text);
        }
        if let Some(exit) = update.exit {
            println!("finished in {:?}: {}", exit.elapsed, exit.success);
            break;
        }
        std::thread::sleep(Duration::from_millis(50));
    }
    Ok(())
}