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§
Sourcefn run(
&self,
request: &ProcessRequest,
) -> Result<ProcessOutput, ProcessExecutionError>
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.
Sourcefn run_with_timeout(
&self,
request: &ProcessRequest,
timeout: Duration,
) -> Result<ProcessOutput, ProcessExecutionError>
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.