Skip to main content

CommandRunner

Trait CommandRunner 

Source
pub trait CommandRunner {
    // Required method
    fn run(&self, program: &str, args: &[&str]) -> Result<Output, Error>;
}
Expand description

Trait for executing system commands, enabling test injection.

Production code uses RealCommandRunner; tests inject MockCommandRunner to verify behavior without side effects.

Required Methods§

Source

fn run(&self, program: &str, args: &[&str]) -> Result<Output, Error>

Execute a command with the given arguments and return the output.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§