Macro cmd_lib::run_cmd [−][src]
run_cmd!() { /* proc-macro */ }
Run commands, returning result handle to check status
let msg = "I love rust"; run_cmd!(echo $msg)?; run_cmd!(echo "This is the message: $msg")?; // pipe commands are also supported run_cmd!(du -ah . | sort -hr | head -n 10)?; // or a group of commands // if any command fails, just return Err(...) let file = "/tmp/f"; let keyword = "rust"; if run_cmd! { cat ${file} | grep ${keyword}; echo "bad cmd" >&2; ls /nofile || true; date; ls oops; cat oops; }.is_err() { // your error handling code }