2e8d2d74014f366461d36712840ea59e8f734df3

Author
Marc Cornellà <marc@mcornella.com>
Committer
GitHub <noreply@github.com>
Date

Message

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

Co-authored-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>

Diff

 1diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh
 2index f81c266a461afe564c404cc065c9211582440060..76d66b301db0557b40636c215feda1338168e31c 100644
 3--- a/plugins/pipenv/pipenv.plugin.zsh
 4+++ b/plugins/pipenv/pipenv.plugin.zsh
 5@@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
 6     if [[ ! -f "$PWD/Pipfile" ]]; then
 7       if [[ "$PIPENV_ACTIVE" == 1 ]]; then
 8         if [[ "$PWD" != "$pipfile_dir"* ]]; then
 9-          exit
10+          unset PIPENV_ACTIVE pipfile_dir
11+          deactivate
12         fi
13       fi
14     fi
15@@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
16     if [[ "$PIPENV_ACTIVE" != 1 ]]; then
17       if [[ -f "$PWD/Pipfile" ]]; then
18         export pipfile_dir="$PWD"
19-        pipenv shell
20+        source "$(pipenv --venv)/bin/activate"
21+        export PIPENV_ACTIVE=1
22       fi
23     fi
24   }