Skip to content
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

Use new EnvironmentVariableCollection API #51

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

anton-matosov
Copy link
Contributor

new EnvironmentVariableCollection API introduced in microsoft/vscode#179476 allows to (re)apply environment variables at the shell integration stage. This is crucial for macOS which uses login shell as default and overrides or prepends set PATH on startup, leading to micromamba paths being absent or push towards the end. This results in system binaries being used as default, essentially deactivating the conda environment

Update @types/vscode and @vscode/test-electron to the latest versions to allow use of the new API

Pass in EnvironmentVariableMutatorOptions{ applyAtProcessCreation: true, applyAtShellIntegration: true } to guarantee PATH and other environment variables reapplication after default shell initializtion is complete

Add filtering of the standard shell and vscode environment variables in parseMicromambaShellActivateResponse in order to avoid attempting to change read-only variables like PWD and SHLVL as well as causing potential side effects with process specific variables like VSCODE_ (see in code comments for more details)

…on all shells and OS

microsoft/vscode#179476 Introduced a new API for EnvironmentVariableCollection that properly handles shell integrations, including login always shells on macOS

Update `@types/vscode` and `@vscode/test-electron` to the latest versions to allow use of the new API
Update `activateTerminal` to use new API:
 - use `applyAtShellIntegration: true` only for `PATH` variable because `info.vars` contains entrire environment, including read only variables like `PWD`, `SHLVL` and `_` which will error out.
 TODO: these read only vars and maybe some others should be cleaned up before replacing them everywhere
…void conficts upon propagation to new shell and subprocesses
@coveralls
Copy link

coveralls commented Jul 25, 2024

Pull Request Test Coverage Report for Build 10086318472

Details

  • 4 of 9 (44.44%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 58.616%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/activations/activateTerminal.ts 0 5 0.0%
Totals Coverage Status
Change from base Build 9595185128: 0.5%
Covered Lines: 397
Relevant Lines: 620

💛 - Coveralls

@corker corker merged commit 4461000 into mamba-org:main Aug 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants