Files
topgrade/src/windows.rs

21 lines
544 B
Rust
Raw Normal View History

2018-08-19 14:45:23 +03:00
use super::terminal::Terminal;
use super::utils::{self, Check};
2018-06-28 12:16:54 +03:00
use failure;
use std::process::Command;
2018-08-19 14:45:23 +03:00
#[must_use]
pub fn run_chocolatey(terminal: &mut Terminal) -> Option<(&'static str, bool)> {
if let Some(choco) = utils::which("choco") {
terminal.print_separator("Chocolatey");
2018-06-28 12:16:54 +03:00
2018-08-19 14:45:23 +03:00
let success = || -> Result<(), failure::Error> {
Command::new(&choco).args(&["upgrade", "all"]).spawn()?.wait()?.check()?;
Ok(())
}().is_ok();
return Some(("Chocolatey", success));
}
None
2018-06-28 12:16:54 +03:00
}