Given two environments FOO (which sets env var MY_ENV=hello) and BAR (which sets MY_ENV=goodbye"):
- activate
FOO
- without deactivating
FOO, activate BAR
- Hermit prepends
BAR/bin to PATH without first removing FOO/bin and creates the environment variable _HERMIT_OLD_MY_ENV=hello
- run
deactivate-hermit
- Hermit removes
BAR/bin from PATH and restores MY_ENV=hello.
- Issue: we are no longer in an activated hermit env, but we still have
FOO/bin on PATH and still have MY_ENV=hello. Carrying artifacts of a previously activated hermit env around could have odd consequences, especially if something like JAVA_HOME is left set.
I assume that keeping FOO/bin on PATH is intentional for the sake of convenience in nested environments. If that is indeed the case, then one way to resolve this may be to keep a stack of previously activated environments and either:
- change
deactivate-hermit to only deactivate a single environment (sounds more annoying than useful)
- ensure that
deactivate-hermit explicitly unwinds all previously activated environments
I also noticed that shell-hooks will always explicitly deactivate environments before activating a new one, making it impossible to encounter this issue.
Given two environments
FOO(which sets env varMY_ENV=hello) andBAR(which setsMY_ENV=goodbye"):FOOFOO, activateBARBAR/bintoPATHwithout first removingFOO/binand creates the environment variable_HERMIT_OLD_MY_ENV=hellodeactivate-hermitBAR/binfromPATHand restoresMY_ENV=hello.FOO/binonPATHand still haveMY_ENV=hello. Carrying artifacts of a previously activated hermit env around could have odd consequences, especially if something like JAVA_HOME is left set.I assume that keeping
FOO/binonPATHis intentional for the sake of convenience in nested environments. If that is indeed the case, then one way to resolve this may be to keep a stack of previously activated environments and either:deactivate-hermitto only deactivate a single environment (sounds more annoying than useful)deactivate-hermitexplicitly unwinds all previously activated environmentsI also noticed that shell-hooks will always explicitly deactivate environments before activating a new one, making it impossible to encounter this issue.