Crates.io | babash |
lib.rs | babash |
version | 0.2.0 |
source | src |
created_at | 2020-12-30 12:35:14.895311 |
updated_at | 2021-02-02 10:02:10.94014 |
description | An tiny wrapper around `std::process::Command` |
homepage | |
repository | https://github.com/imbolc/babash |
max_upload_size | |
id | 329224 |
size | 10,072 |
An tiny wrapper around std::process::Command
sacrificing performance for simplicity.
utf-8
environmentfn main() -> std::io::Result<()> {
stderrlog::new().verbosity(4).init().unwrap();
let r = babash::call("foo")?; // doesn't check for exit status
assert_eq!(r.code, Some(127));
babash::ensure_call("bar")?; // produces an error on an bad exit status
Ok(())
}
produces the following logging output:
INFO - Calling: foo
DEBUG - Response {
command: "foo",
code: Some(
127,
),
success: false,
stdout: "",
stderr: "sh: 1: foo: not found\n",
}
INFO - Calling: bar
ERROR - Response {
command: "bar",
code: Some(
127,
),
success: false,
stdout: "",
stderr: "sh: 1: bar: not found\n",
}
Error: Custom { kind: Other, error: "Unsuccessful call: Response {\n command: \"bar\",\n code: Some(\n
127,\n ),\n success: false,\n stdout: \"\",\n stderr: \"sh: 1: bar: not found\\n\",\n}" }