summaryrefslogtreecommitdiff
path: root/plugins/virtualenvwrapper
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-02-19 17:12:23 -0600
committerTuowen Zhao <ztuowen@gmail.com>2022-02-19 17:12:23 -0600
commitcae9a2b797649379e865e6bd73bc67e294e4ac77 (patch)
tree481419eff4bc761c3ca516704427394193473419 /plugins/virtualenvwrapper
parent49edbf438ed690c76e6b2af80368c59404cf0167 (diff)
parent3427da4057dbe302933a7b5b19b4e23bfb9d0969 (diff)
downloadzsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.gz
zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.tar.bz2
zsh-cae9a2b797649379e865e6bd73bc67e294e4ac77.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/virtualenvwrapper')
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index c30216f51..d359e0c21 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -56,7 +56,13 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_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
+ if [[ -n "$VIRTUAL_ENV" ]]; then
+ # Only deactivate if VIRTUAL_ENV was set
+ # User may have deactivated manually or via another mechanism
+ deactivate
+ fi
+ # clean up regardless
+ unset CD_VIRTUAL_ENV
fi
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active