Trait sheller::CommandExt
source · pub trait CommandExt {
// Required methods
fn run(&mut self);
fn try_run(&mut self) -> Result<(), Error>;
fn run_with_config(&mut self, config: &Config);
fn try_run_with_config(&mut self, config: &Config) -> Result<(), Error>;
}Required Methods§
sourcefn try_run(&mut self) -> Result<(), Error>
fn try_run(&mut self) -> Result<(), Error>
Run the command and return a Result with Ok if the command was successful, and Err if the command failed.
§Examples
use std::process::Command;
use sheller::CommandExt;
let mut command = Command::new("echo");
command.arg("hello");
command.try_run().unwrap();§Errors
Returns an Err if the command failed to run.
sourcefn run_with_config(&mut self, config: &Config)
fn run_with_config(&mut self, config: &Config)
Run the command with the given config and panic if the command failed to run.
§Examples
use std::process::Command;
use sheller::{Config, CommandExt};
let mut command = Command::new("echo");
command.arg("hello");
let config = Config::default();
command.run_with_config(&config);§Panics
Panics if the command failed to run.
sourcefn try_run_with_config(&mut self, config: &Config) -> Result<(), Error>
fn try_run_with_config(&mut self, config: &Config) -> Result<(), Error>
Run the command with the given config and return a Result with Ok if the command was successful, and Err if the command failed.
§Examples
use std::process::Command;
use sheller::{Config, CommandExt};
let mut command = Command::new("echo");
command.arg("hello");
let config = Config::default();
command.try_run_with_config(&config).unwrap();§Errors
Returns an Err if the command failed to run.
Implementations on Foreign Types§
source§impl CommandExt for Command
impl CommandExt for Command
source§fn run_with_config(&mut self, config: &Config)
fn run_with_config(&mut self, config: &Config)
Run the command and panic if the command failed to run.
§Examples
use std::process::Command;
use sheller::{Config, CommandExt};
let mut command = Command::new("echo");
command.arg("hello");
let config = Config::default();
command.run_with_config(&config);§Panics
Panics if the command failed to run.
source§fn try_run(&mut self) -> Result<(), Error>
fn try_run(&mut self) -> Result<(), Error>
Run the command and return a Result with Ok if the command was successful, and Err if the command failed.
§Examples
use std::process::Command;
use sheller::CommandExt;
let mut command = Command::new("echo");
command.arg("hello");
command.try_run().unwrap();§Errors
Returns an Err if the command failed to run.
source§fn try_run_with_config(&mut self, config: &Config) -> Result<(), Error>
fn try_run_with_config(&mut self, config: &Config) -> Result<(), Error>
Run the command with the given config and return a Result with Ok if the command was successful, and Err if the command failed.
§Examples
use std::process::Command;
use sheller::{Config, CommandExt};
let mut command = Command::new("echo");
command.arg("hello");
let config = Config::default();
command.try_run_with_config(&config).unwrap();§Errors
Returns an Err if the command failed to run.