Skip to main content

CommandExecutor

Trait CommandExecutor 

Source
pub trait CommandExecutor: Send + Sync {
    // Required methods
    fn execute(&self, program: &str, args: &[&str]) -> Result<CommandOutput>;
    fn execute_in_dir(
        &self,
        program: &str,
        args: &[&str],
        dir: &str,
    ) -> Result<CommandOutput>;
}
Expand description

Trait for executing shell commands

This abstraction allows mocking command execution in tests.

Required Methods§

Source

fn execute(&self, program: &str, args: &[&str]) -> Result<CommandOutput>

Execute a command and return its output

Source

fn execute_in_dir( &self, program: &str, args: &[&str], dir: &str, ) -> Result<CommandOutput>

Execute a command in a specific directory

Implementors§