From 155f4bf45204b3090cc07271d2648ac7c024bbd1 Mon Sep 17 00:00:00 2001 From: notgne2 Date: Sun, 25 Oct 2020 13:15:35 -0700 Subject: Fail correctly if initial activation fails --- src/activate.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/activate.rs b/src/activate.rs index 55ceb27..4fdb59c 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -114,7 +114,7 @@ pub async fn deactivate(profile_path: &str) -> Result<(), Box (), - _ if auto_rollback => return Ok(deactivate(&profile_path).await?), - _ => (), - } + let activate_status_all = match activate_status { + Ok(s) if s.success() => Ok(()), + Ok(_) => Err(std::io::Error::new(std::io::ErrorKind::Other, "Activation did not succeed")), + Err(x) => Err(x), + }; + + deactivate_on_err(&profile_path, activate_status_all).await; info!("Activation succeeded!"); -- cgit v1.2.3