fix(pipenv): fix auto-shell functionality when cd-ing out

This change uses traditional `activate` instead of `pipenv shell`
so that transitions between pipenv projects happen in the same
shell and it's possible to properly deactivate the shell.

Fixes #12184

Co-authored-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
This commit is contained in:
Marc Cornellà 2024-11-19 20:58:18 +01:00
commit aeb10f2c58
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ ! -f "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
exit
unset PIPENV_ACTIVE pipfile_dir
deactivate
fi
fi
fi
@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
source "$(pipenv --venv)/bin/activate"
export PIPENV_ACTIVE=1
fi
fi
}