64fad6a26c325018c0c9c8477e551b4d53855083

Author
Steven Xu <stevenxxiu@gmail.com>
Committer
Steven Xu <stevenxxiu@gmail.com>
Date

Message

fix: don't use `$venv_path` if we don't have *Pipenv* or *Poetry* installed

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index c7dc57dc2c655e36d1620fad45ef273091017a3f..cf674cb1f79f5a84850cf29c8f894e796f4acb4a 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -189,12 +189,12 @@ function check_venv()
 6             printf "Reason: Found a $AUTOSWITCH_FILE file with weak permission settings ($file_permissions).\n"
 7             printf "Run the following command to fix this: ${PURPLE}\"chmod 600 $venv_path\"${NORMAL}\n"
 8         else
 9-            if [[ "$venv_path" == *"/Pipfile" ]] && type "pipenv" > /dev/null; then
10-                if _activate_pipenv; then
11+            if [[ "$venv_path" == *"/Pipfile" ]]; then
12+                if type "pipenv" > /dev/null && _activate_pipenv; then
13                     return
14                 fi
15-            elif [[ "$venv_path" == *"/poetry.lock" ]] && type "poetry" > /dev/null; then
16-                if _activate_poetry; then
17+            elif [[ "$venv_path" == *"/poetry.lock" ]]; then
18+                if type "poetry" > /dev/null && _activate_poetry; then
19                     return
20                 fi
21             else