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

fix: manual environment switching with overlapping environments #397

Merged
merged 1 commit into from Mar 13, 2024

Conversation

jvmakine
Copy link
Collaborator

Previously, we deactivated previous environment after activating a new one. This meant that if both evironments shared env variables, the deactivation script would unset them for the new environment, leaving them unset. This was not issue when using shell-hooks, as those explicitly deactivate an environment before activating a new one.

For example:

> cat env1/bin/hermit.hcl
env = {
  FOO:BAR,
}
> cat env2/bin/hermit.hcl
env = {
  FOO:BAR,
}
> cd env1
> . bin/activate-hermit
Hermit environment /Users/juho/tmp/hermit-test/env1 activated
> echo $FOO
BAR
> cd ../env2
> . bin/activate-hermit
Hermit environment /Users/juho/tmp/hermit-test/env1 deactivated
Hermit environment /Users/juho/tmp/hermit-test/env2 activated
> echo $FOO

>

Previously, we deactivated previous environment after activating a new one. This meant that if both evironments shared env variables, the deactivation script would unset them for the new environment, leaving them unset. This was not issue when using shell-hooks, as those explicitly deactivate an environment before activating a new one.

For example:
```
> cat env1/bin/hermit.hcl
env = {
  FOO:BAR,
}
> cat env2/bin/hermit.hcl
env = {
  FOO:BAR,
}
> cd env1
> . bin/activate-hermit
Hermit environment /Users/juho/tmp/hermit-test/env1 activated
> echo $FOO
BAR
> cd ../env2
> . bin/activate-hermit
Hermit environment /Users/juho/tmp/hermit-test/env1 deactivated
Hermit environment /Users/juho/tmp/hermit-test/env2 activated
> echo $FOO

>
```
"io"
"text/template"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html/template was escaping single quotes, so switched to text/template

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.

@jvmakine jvmakine merged commit 4a6b052 into master Mar 13, 2024
6 checks passed
@jvmakine jvmakine deleted the juho/env-overlap-activation-fix branch March 13, 2024 03:11
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.

None yet

2 participants