From d6671249b72fb442266ae2eeb33a479dd4d07f1e Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sun, 12 Oct 2014 21:34:18 +0900 Subject: [PATCH] Should not persist `PYENV_DEACTIVATE` after automatic deactivation (#47, #48) --- bin/pyenv-virtualenv-init | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/pyenv-virtualenv-init b/bin/pyenv-virtualenv-init index 1ec7f20..66562a1 100755 --- a/bin/pyenv-virtualenv-init +++ b/bin/pyenv-virtualenv-init @@ -78,10 +78,12 @@ function _pyenv_virtualenv_hook --on-event fish_prompt; if [ -n "\$PYENV_ACTIVATE" ] if [ (pyenv version-name) = "system" ] pyenv deactivate --no-error --verbose + set -e PYENV_DEACTIVATE return 0 end if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ] if pyenv deactivate --no-error --verbose + set -e PYENV_DEACTIVATE pyenv activate --no-error --verbose; or set -e PYENV_DEACTIVATE else pyenv activate --no-error --verbose @@ -117,6 +119,7 @@ if [[ "$shell" != "fish" ]]; then fi if [ "\$PYENV_ACTIVATE" != "\$(pyenv prefix)" ]; then if pyenv deactivate --no-error --verbose; then + unset PYENV_DEACTIVATE pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE else pyenv activate --no-error --verbose