Skip to main content

CommandExecutor

Trait CommandExecutor 

Source
pub trait CommandExecutor: Debug {
    // Required method
    fn run(
        &self,
        argv: &[String],
        stdin_data: Option<&[u8]>,
        timeout: Duration,
    ) -> Result<ManagerCommandOutput, ServiceError>;
}
Expand description

Injectable manager-command executor (literal argv, no shell).

Implementations run the program directly with the given arguments, a controlled stdin policy, a deadline, and bounded output. No shell interpolation is performed. SystemExecutor is the production implementation; FakeExecutor scripts deterministic responses for tests.

Required Methods§

Source

fn run( &self, argv: &[String], stdin_data: Option<&[u8]>, timeout: Duration, ) -> Result<ManagerCommandOutput, ServiceError>

Runs argv[0] with argv[1..] within timeout.

stdin_data is None for null stdin; Some(bytes) streams bounded input (used only for crontab -). Missing binaries, timeouts, and output-bound overflows are Err(ServiceError::Manager); nonzero exits are Ok with the observed status for caller classification.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§