CommandRunner

Trait CommandRunner 

Source
pub trait CommandRunner: Send + Sync {
    // Required method
    fn run_script(
        &self,
        script_path: &str,
        stdin_content: &str,
        env_vars: &[(&str, &str)],
    ) -> Result<Output>;
}
Expand description

Trait for running shell commands.

Enables mocking in tests to verify error handling without actual failures. Uses generics for zero-cost abstraction in production code.

Required Methods§

Source

fn run_script( &self, script_path: &str, stdin_content: &str, env_vars: &[(&str, &str)], ) -> Result<Output>

Run a validator script with the given stdin content and environment variables.

§Arguments
  • script_path - Path to the script to execute (run via sh)
  • stdin_content - Content to write to the script’s stdin
  • env_vars - Environment variables to set for the script
§Errors

Returns error if spawning the process, writing stdin, or waiting for output fails.

Implementors§