ARM Brew support (#585)

This commit is contained in:
Roey Darwish Dror
2020-12-16 13:43:38 +02:00
committed by GitHub
parent e2cc0a8547
commit 1fdf9c78b7
3 changed files with 96 additions and 19 deletions

View File

@@ -264,3 +264,26 @@ impl CommandExt for Command {
Ok(String::from_utf8(output.stdout)?)
}
}
impl CommandExt for Executor {
fn check_output(&mut self) -> Result<String> {
let output = match self.output()? {
ExecutorOutput::Wet(output) => output,
ExecutorOutput::Dry => unreachable!(),
};
let status = output.status;
if !status.success() {
let stderr = String::from_utf8(output.stderr).unwrap_or_default();
return Err(TopgradeError::ProcessFailedWithOutput(status, stderr).into());
}
Ok(String::from_utf8(output.stdout)?)
}
fn string_output(&mut self) -> Result<String> {
let output = match self.output()? {
ExecutorOutput::Wet(output) => output,
ExecutorOutput::Dry => unreachable!(),
};
Ok(String::from_utf8(output.stdout)?)
}
}