Browse Source

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

virtualenvwrapper: Deactivate only if in virtualenv
Robby Russell 9 years ago
parent
commit
13e5afe805
1 changed files with 1 additions and 1 deletions
  1. 1 1
      plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh

+ 1 - 1
plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh

@@ -38,7 +38,7 @@ if (( $+commands[$virtualenvwrapper] )); then
                 source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
                 source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
               fi
               fi
             fi
             fi
-          elif [ $CD_VIRTUAL_ENV ]; then
+          elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
             # We've just left the repo, deactivate the environment
             # We've just left the repo, deactivate the environment
             # Note: this only happens if the virtualenv was activated automatically
             # Note: this only happens if the virtualenv was activated automatically
             deactivate && unset CD_VIRTUAL_ENV
             deactivate && unset CD_VIRTUAL_ENV