blob: 296c82e1abe7626cd630e2f6b6dcb22e3da0a61f (
plain)
1
2
3
4
5
6
7
8
9
|
use std::{io, process::Command};
/// Helper for getting stdout of some command as a String. Ignores the exit code of the command.
pub fn command_stdout_lossy(cmd: &str, args: &[&str]) -> io::Result<String> {
Command::new(cmd)
.args(args)
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
}
|