pub trait CommandRunner {
// Required methods
fn run(
&self,
spec: &CommandSpec,
io: IoPolicy,
) -> Result<CommandOutput, ProcessError>;
fn spawn_detached(&self, spec: &CommandSpec) -> Result<(), ProcessError>;
// Provided method
fn run_checked(
&self,
spec: &CommandSpec,
io: IoPolicy,
) -> Result<CommandOutput, ProcessError> { ... }
}Expand description
Executes CommandSpecs.
Required Methods§
Sourcefn run(
&self,
spec: &CommandSpec,
io: IoPolicy,
) -> Result<CommandOutput, ProcessError>
fn run( &self, spec: &CommandSpec, io: IoPolicy, ) -> Result<CommandOutput, ProcessError>
Runs the command to completion.
§Errors
Returns ProcessError::NotFound or ProcessError::Spawn if the
program could not be started.
Sourcefn spawn_detached(&self, spec: &CommandSpec) -> Result<(), ProcessError>
fn spawn_detached(&self, spec: &CommandSpec) -> Result<(), ProcessError>
Starts the command without waiting for it to finish.
§Errors
Returns ProcessError::NotFound or ProcessError::Spawn if the
program could not be started.
Provided Methods§
Sourcefn run_checked(
&self,
spec: &CommandSpec,
io: IoPolicy,
) -> Result<CommandOutput, ProcessError>
fn run_checked( &self, spec: &CommandSpec, io: IoPolicy, ) -> Result<CommandOutput, ProcessError>
Runs the command and fails if it exits unsuccessfully.
§Errors
As CommandRunner::run, plus ProcessError::Failed if the process
exited with a non-success status.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".