[][src]Macro cmd_lib::run_cmd

macro_rules! run_cmd {
    (use $($arg:tt)*) => { ... };
    (&$st:expr; $var:ident, $($arg:tt)*) => { ... };
    (&$st:expr; $var:ident; $($arg:tt)*) => { ... };
    ($cmd:ident $($arg:tt)*) => { ... };
    ($($arg:tt)*) => { ... };
}

run_cmd! --> CmdResult

let name = "rust";
run_cmd!("echo hello, {}", name);

// pipe commands are also supported
run_cmd!("du -ah . | sort -hr | head -n 10");

// work without string quote
run_cmd!(du -ah . | sort -hr | head -n 10);

// or a group of commands
// if any command fails, just return Err(...)
run_cmd!{
    use file;

    date;
    ls -l ${file};
}