Skip to content

feat: Add generate_deactivation_script() function in the shell_hook.rs #3670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: allow env_vars to restore to pre-activation state
  • Loading branch information
mrswastik-robot committed May 27, 2025
commit 62c5571aff2e004dcc159b243a8080931d52fb5a
3 changes: 3 additions & 0 deletions src/activation.rs
Original file line number Diff line number Diff line change
@@ -293,6 +293,9 @@ pub async fn run_activation(

// Prepending environment paths so they get found first.
path_modification_behavior,

// Current environment variables
current_env: HashMap::new(),
},
None,
)
4 changes: 4 additions & 0 deletions src/cli/shell_hook.rs
Original file line number Diff line number Diff line change
@@ -83,6 +83,9 @@ async fn generate_activation_script(
.unwrap_or_else(|| ShellEnum::from_env().unwrap_or_default())
});

// Read current environment variables
let current_env = std::env::vars().collect::<HashMap<String, String>>();

let activator = get_activator(environment, shell.clone()).into_diagnostic()?;

let path = std::env::var("PATH")
@@ -97,6 +100,7 @@ async fn generate_activation_script(
conda_prefix,
path,
path_modification_behavior: PathModificationBehavior::default(),
current_env,
})
.into_diagnostic()?;