Closed manfredlotz closed 1 year ago
➜ rust_cmd_lib git:(master) ✗ cat examples/catch_all.rs
use cmd_lib::*;
#[cmd_lib::main]
fn main() -> MainResult {
let (cmd_res, stdout_res, stderr_res) = spawn_with_output!(ls -d / /xxx)?.wait_with_all();
info!("cmd err: {}", cmd_res.unwrap_err());
info!("stdout: {}", stdout_res.unwrap());
info!("stderr: {}", stderr_res.unwrap());
Ok(())
}
➜ rust_cmd_lib git:(master) ✗ cargo run --example catch_all
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/examples/catch_all`
[INFO ] cmd err: Running ["ls" "-d" "/" "/xxx"] exited with error; status code: 2
[INFO ] stdout: /
[INFO ] stderr: ls: cannot access '/xxx': No such file or directory
Thanks.
Assume I run a find command and its output shows found items and also some errors like this
Here I like to catch
How can I do this? Thanks.