2020-04-16 04:16:40 -07:00
|
|
|
use crate::common::*;
|
|
|
|
|
|
|
|
pub(crate) trait CommandExt {
|
|
|
|
#[throws]
|
|
|
|
fn out(&mut self) -> String;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CommandExt for Command {
|
|
|
|
#[throws]
|
|
|
|
fn out(&mut self) -> String {
|
2020-04-22 13:32:36 -07:00
|
|
|
info!("Running {:?}…", self);
|
|
|
|
|
2020-04-16 04:16:40 -07:00
|
|
|
let output = self
|
|
|
|
.stdout(Stdio::piped())
|
|
|
|
.stderr(Stdio::inherit())
|
|
|
|
.output()?;
|
|
|
|
|
|
|
|
output.status.into_result()?;
|
|
|
|
|
|
|
|
let text = String::from_utf8(output.stdout)?;
|
|
|
|
|
|
|
|
text
|
|
|
|
}
|
|
|
|
}
|