Skip to main content

CommandUtils

Trait CommandUtils 

Source
pub trait CommandUtils {
    // Required methods
    fn exec(&mut self) -> Result<Output>;
    fn spawn_output(&mut self) -> Result<Output>;
    fn get_stdout_lossy(&mut self) -> Result<String>;
}
Expand description

Useful extensions to std::process::Command.

Required Methods§

Source

fn exec(&mut self) -> Result<Output>

Returns the command’s output if execution is successful, otherwise, throws an error.

Source

fn spawn_output(&mut self) -> Result<Output>

Runs the command and returns its output whatever the exit status. Unlike Command::output, the error names the program when it cannot be started.

Source

fn get_stdout_lossy(&mut self) -> Result<String>

Returns the command’s stdout if execution is successful, otherwise, throws an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl CommandUtils for Command

Implementors§