From 4e1e0788f872f0f72335366f3d1e1f59a304f671 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 4 Nov 2019 22:49:22 +0200 Subject: [PATCH] Fix a scenario where fwupdmgr has nothing to update (fix #246) --- src/steps/os/linux.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index f3e27c5f..a917ff9d 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -1,6 +1,6 @@ use crate::config::Config; use crate::error::{Error, ErrorKind}; -use crate::executor::RunType; +use crate::executor::{ExecutorExitStatus, RunType}; use crate::terminal::{print_separator, print_warning}; use crate::utils::{require, require_option, which, PathExt}; use failure::ResultExt; @@ -349,7 +349,15 @@ pub fn run_fwupdmgr(run_type: RunType) -> Result<(), Error> { print_separator("Firmware upgrades"); run_type.execute(&fwupdmgr).arg("refresh").check_run()?; - run_type.execute(&fwupdmgr).arg("get-updates").check_run() + let exit_status = run_type.execute(&fwupdmgr).arg("get-updates").spawn()?.wait()?; + + if let ExecutorExitStatus::Wet(e) = exit_status { + if !(e.success() || e.code().map(|c| c == 2).unwrap_or(false)) { + return Err(ErrorKind::ProcessFailed(e).into()); + } + } + + Ok(()) } #[must_use]