Unverified Commit 1e615b71 authored by Zachary Cutlip's avatar Zachary Cutlip Committed by GitHub

fix(virtualenvwrapper): only deactivate if virtual env is still present (#10671)

parent 0da33ca2
...@@ -56,7 +56,13 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then ...@@ -56,7 +56,13 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_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 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 fi
if [[ "$ENV_NAME" != "" ]]; then if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active # Activate the environment only if it is not already active
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment