Skip to main content

CommandRunner

Trait CommandRunner 

Source
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§

Source

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.

Source

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§

Source

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".

Implementors§