diff --git a/bin/pyenv-virtualenv-init b/bin/pyenv-virtualenv-init index a02d9a8..e0f4017 100755 --- a/bin/pyenv-virtualenv-init +++ b/bin/pyenv-virtualenv-init @@ -75,13 +75,14 @@ case "$shell" in fish ) cat </dev/null; or true) if [ -n "\$PYENV_ACTIVATE" ] if [ "(pyenv version-name 2>/dev/null; or true)" = "system" ] pyenv deactivate --no-error --verbose set -e PYENV_DEACTIVATE return 0 end - if [ "\$PYENV_ACTIVATE" != "(pyenv prefix 2>/dev/null; or true)" ] + 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 @@ -90,7 +91,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt; end end else - if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != "(pyenv prefix 2>/dev/null; or true)" ] + if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != "\$PYENV_PREFIX" ] pyenv activate --no-error --verbose end end diff --git a/test/init.bats b/test/init.bats index 3ad95bf..10abb64 100644 --- a/test/init.bats +++ b/test/init.bats @@ -63,13 +63,14 @@ EOS assert_output </dev/null; or true) if [ -n "\$PYENV_ACTIVATE" ] if [ "(pyenv version-name 2>/dev/null; or true)" = "system" ] pyenv deactivate --no-error --verbose set -e PYENV_DEACTIVATE return 0 end - if [ "\$PYENV_ACTIVATE" != "(pyenv prefix 2>/dev/null; or true)" ] + 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 @@ -78,7 +79,7 @@ function _pyenv_virtualenv_hook --on-event fish_prompt; end end else - if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != "(pyenv prefix 2>/dev/null; or true)" ] + if [ -z "\$VIRTUAL_ENV" ]; and [ "\$PYENV_DEACTIVATE" != "\$PYENV_PREFIX" ] pyenv activate --no-error --verbose end end