Skip to main content

ProcessRunner

Trait ProcessRunner 

Source
pub trait ProcessRunner {
    // Required methods
    fn run(
        &self,
        request: &ProcessRequest,
    ) -> Result<ProcessOutput, ProcessExecutionError>;
    fn run_with_timeout(
        &self,
        request: &ProcessRequest,
        timeout: Duration,
    ) -> Result<ProcessOutput, ProcessExecutionError>;
}
Expand description

Abstraction for process execution.

Required Methods§

Source

fn run( &self, request: &ProcessRequest, ) -> Result<ProcessOutput, ProcessExecutionError>

Execute a process and wait for completion, capturing all output.

This method blocks until the process exits or fails to start. Both stdout and stderr are captured and returned in the result.

Source

fn run_with_timeout( &self, request: &ProcessRequest, timeout: Duration, ) -> Result<ProcessOutput, ProcessExecutionError>

Execute a process with a timeout, capturing all output.

If the process doesn’t complete within the timeout, it will be killed and the result will have timed_out set to true. Output captured before the timeout is still returned.

Implementors§