mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 15:30:40 +01:00
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
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user