(command: Command)
| 51 | } |
| 52 | |
| 53 | pub fn run_shell_command(command: Command) -> Result<String, Error> { |
| 54 | let mut process = ProcessCommand::new(command.program); |
| 55 | process.args(command.args); |
| 56 | let output = process.output()?; |
| 57 | Ok(strip_trailing_newline(&String::from_utf8_lossy(&output.stdout)).to_string()) |
| 58 | } |
| 59 | |
| 60 | pub fn strip_trailing_newline(input: &str) -> &str { |
| 61 | input |