diff options
author | Jyrki Pulliainen <jyrki@spotify.com> | 2015-01-07 18:15:00 +0100 |
---|---|---|
committer | Jyrki Pulliainen <jyrki@spotify.com> | 2015-01-07 18:17:29 +0100 |
commit | 833e6f5958b9851d2dbcf8ae706474af4079a25e (patch) | |
tree | bd9cb9d5cacfe4bd481b430d0485b841ef817d98 /plugins/virtualenvwrapper | |
parent | 175b4a807383530aa75145b5b6fdedb3ce1f11f2 (diff) | |
download | zsh-833e6f5958b9851d2dbcf8ae706474af4079a25e.tar.gz zsh-833e6f5958b9851d2dbcf8ae706474af4079a25e.tar.bz2 zsh-833e6f5958b9851d2dbcf8ae706474af4079a25e.zip |
virtualenvwrapper: Deactivate only if in virtualenv
If user manually deactivates the virtualenv when using this mode, zsh
will produce following error:
deactivate:12: command not found: virtualenv_deactivate
To avoid this, check that the VIRTUAL_ENV flag is set before trying to
automatically deactivate the virtual environment.
Fixes #2185
Diffstat (limited to 'plugins/virtualenvwrapper')
-rw-r--r-- | plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 52e02d3e0..217ab0722 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -38,7 +38,7 @@ if (( $+commands[$virtualenvwrapper] )); then source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME" 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 # Note: this only happens if the virtualenv was activated automatically deactivate && unset CD_VIRTUAL_ENV |