Skip to main content

CommandRunner

Trait CommandRunner 

Source
pub trait CommandRunner:
    Debug
    + Send
    + Sync {
    // Required method
    fn run(&self, request: &CommandRequest) -> Result<CommandOutput, WslError>;
}
Expand description

Runs a CommandRequest.

The whole reason the WSL adapter is testable on a Linux CI leg: production injects HostCommandRunner, every test injects ScriptedRunner, and nothing above this trait knows the difference.

Required Methods§

Source

fn run(&self, request: &CommandRequest) -> Result<CommandOutput, WslError>

Runs it, or says why it could not be started.

A non-zero exit is not an error here — it is a CommandOutput with a code. Only a failure to launch, a refused payload, or an operating-system failure while waiting is an Err.

§Errors

WslError::Spawn, WslError::SecretInCommandLine, or WslError::ChildControl.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§