13e5afe805f28749f4aa6a5e82272760a62ad573

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #3164 from nailor/fix-deactivate-bug

virtualenvwrapper: Deactivate only if in virtualenv

Diff

 1diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 2index 52e02d3e01390c77f669d2fa657d2b65e7ae5029..217ab0722dd3cb022ba9fa8bf8226629c58ab713 100644
 3--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 4+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 5@@ -38,7 +38,7 @@ if (( $+commands[$virtualenvwrapper] )); then
 6                 source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
 7               fi
 8             fi
 9-          elif [ $CD_VIRTUAL_ENV ]; then
10+          elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
11             # We've just left the repo, deactivate the environment
12             # Note: this only happens if the virtualenv was activated automatically
13             deactivate && unset CD_VIRTUAL_ENV