Skip to main content

Runner

Trait Runner 

Source
pub trait Runner: Send + Sync {
    // Required method
    fn run(&self, cmd: Cmd) -> Result<RunOutput, RunError>;
}
Expand description

Pluggable backend for executing a Cmd. See the module-level docs.

Send + Sync so a &dyn Runner can cross thread / task boundaries.

§Scope

This trait only abstracts the sync Cmd::run path. Code that calls Cmd::spawn, Cmd::spawn_and_collect_lines, or (with the tokio feature) [Cmd::run_async] / [Cmd::spawn_async] still invokes the real subprocess machinery — those paths aren’t mockable through this trait in procpilot 0.7. If you want your code fully testable without spawning processes, route shell-outs through run (via a &dyn Runner) for now. Spawn-handle mocking is tracked as follow-up work.

Required Methods§

Source

fn run(&self, cmd: Cmd) -> Result<RunOutput, RunError>

Execute the Cmd synchronously, blocking until completion. Mirrors Cmd::run.

Implementors§