pub fn output(
program: &str,
args: &[&str],
dir: &Path,
env: &[(&str, &str)],
) -> Result<String>Expand description
Runs an external command and captures its stdout as a String.
Stderr is inherited (printed to the terminal). The returned string has leading/trailing whitespace trimmed.
§Errors
Returns an error if the process cannot be spawned, exits with a non-zero status, or produces non-UTF-8 output.
§Examples
use std::path::Path;
use xtask_lib::tasks::util::cmd::output;
let version = output("cargo", &["--version"], Path::new("."), &[])?;
assert!(version.starts_with("cargo "));