command-run
Rust library for running a command in a subprocess.
This library is a thin wrapper around the std::process::Command
type with a few additional convenient features:
- Print or log the command before running it
- Optionally return an error if the command is not successful
- Optionally combine stdout and stderr
- Optionally print the command's output if the command fails
- The command can be formatted as a command-line string
- The
Command
type can be cloned and its fields are public
Dependencies and features
-
log
- this is an optional dependency. It can be disabled by turning off thelogging
feature:= { = "*", = false }
-
os_pipe
- this dependency is used to implementcombine_output
.
Example
// This will return an error if the command did not exit successfully
// (controlled with the `check` field).
let output = with_args
.enable_capture
.run?;
assert_eq!;