Skip to content

Commit d667124

Browse files
committed
Should not persist PYENV_DEACTIVATE after automatic deactivation (#47, #48)
1 parent 79bfc9d commit d667124

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bin/pyenv-virtualenv-init

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
7878
if [ -n "\$PYENV_ACTIVATE" ]
7979
if [ (pyenv version-name) = "system" ]
8080
pyenv deactivate --no-error --verbose
81+
set -e PYENV_DEACTIVATE
8182
return 0
8283
end
8384
if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ]
8485
if pyenv deactivate --no-error --verbose
86+
set -e PYENV_DEACTIVATE
8587
pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE
8688
else
8789
pyenv activate --no-error --verbose
@@ -117,6 +119,7 @@ if [[ "$shell" != "fish" ]]; then
117119
fi
118120
if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix)" ]; then
119121
if pyenv deactivate --no-error --verbose; then
122+
unset PYENV_DEACTIVATE
120123
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE
121124
else
122125
pyenv activate --no-error --verbose

0 commit comments

Comments
 (0)