diff options
author | Christian Höppner | 2020-11-19 11:18:28 +0000 |
---|---|---|
committer | notgne2 | 2020-11-21 22:42:03 -0700 |
commit | a317b0bcac88725771476d8430caec957ae5e91d (patch) | |
tree | db732322bd7dbdae0c4c22fb14d7dc077fa8f927 /src/activate.rs | |
parent | ef53906075343fdf9f3c81d4c72ff83281410695 (diff) |
Check auto-rollback flag before deactivating
Diffstat (limited to '')
-rw-r--r-- | src/activate.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/activate.rs b/src/activate.rs index 215c086..cc80876 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -288,7 +288,9 @@ pub async fn activate( match nix_env_set_exit_status.code() { Some(0) => (), a => { - deactivate(&profile_path).await?; + if auto_rollback { + deactivate(&profile_path).await?; + } return Err(ActivateError::SetProfileExitError(a)); } }; @@ -302,7 +304,9 @@ pub async fn activate( { Ok(x) => x, Err(e) => { - deactivate(&profile_path).await?; + if auto_rollback { + deactivate(&profile_path).await?; + } return Err(e); } }; @@ -310,7 +314,9 @@ pub async fn activate( match activate_status.code() { Some(0) => (), a => { - deactivate(&profile_path).await?; + if auto_rollback { + deactivate(&profile_path).await?; + } return Err(ActivateError::RunActivateExitError(a)); } }; @@ -324,7 +330,9 @@ pub async fn activate( { Ok(()) => {} Err(err) => { - deactivate(&profile_path).await?; + if auto_rollback { + deactivate(&profile_path).await?; + } return Err(ActivateError::ActivationConfirmationError(err)); } }; |