aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Höppner2020-11-19 11:18:28 +0000
committernotgne22020-11-21 22:42:03 -0700
commita317b0bcac88725771476d8430caec957ae5e91d (patch)
treedb732322bd7dbdae0c4c22fb14d7dc077fa8f927 /src
parentef53906075343fdf9f3c81d4c72ff83281410695 (diff)
Check auto-rollback flag before deactivating
Diffstat (limited to '')
-rw-r--r--src/activate.rs16
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));
}
};