try_run

Macro try_run 

Source
macro_rules! try_run {
    ($script_fmt:expr) => { ... };
    ($script_fmt:expr, $($arg:tt)*) => { ... };
}
Expand description

Macro to try to run a shell script.
It will return a Result. If the script fails, it will return an Err. Otherwise, it will return an Ok.

ยงExamples

use sheller::try_run;

try_run!("echo hello").unwrap();
try_run!("{}", String::from("echo hello")).unwrap();
try_run!("echo {}", "hello").unwrap();
try_run!("echo {hello}", hello = "hello").unwrap();
try_run!("echo {} {world}", "hello", world = "world").unwrap();