Skip to main content

ProcessRunner

Trait ProcessRunner 

Source
pub trait ProcessRunner {
    // Required method
    fn run(
        &self,
        program: &str,
        args: &[&str],
        env: &[(&str, &str)],
        stdio: StdioMode,
    ) -> Result<CommandOutput>;

    // Provided method
    fn run_with_stdin(
        &self,
        program: &str,
        args: &[&str],
        env: &[(&str, &str)],
        stdin: &[u8],
    ) -> Result<CommandOutput> { ... }
}
Expand description

Runs external programs (real OS or a test double).

Required Methods§

Source

fn run( &self, program: &str, args: &[&str], env: &[(&str, &str)], stdio: StdioMode, ) -> Result<CommandOutput>

Execute program with args, optional env, and stdio mode.

§Errors

Returns crate::HortoError when the process cannot be spawned.

Provided Methods§

Source

fn run_with_stdin( &self, program: &str, args: &[&str], env: &[(&str, &str)], stdin: &[u8], ) -> Result<CommandOutput>

Like Self::run with StdioMode::Capture, writing stdin to the child.

Default: unsupported (test doubles that never feed stdin can keep the default).

§Errors

Returns crate::HortoError when spawn/write fails or the runner rejects stdin.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§