5377cc37c0f71fe22484303a4c6f387aa339f3f5

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(pyenv): fix for ignoring pyenv-win commands

The previous fix ignored any pyenv command found in $PATH while on
WSL, regardless of whether it was correctly set up or not.

This change only ignores the pyenv command if it's proved to come
from pyenv-win by looking at its full path.

Diff

 1diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
 2index fedde634211198960be1b4b5c4b36555ae832445..813f64b42de5f316809002f6ae984016da7bd958 100644
 3--- a/plugins/pyenv/pyenv.plugin.zsh
 4+++ b/plugins/pyenv/pyenv.plugin.zsh
 5@@ -1,11 +1,13 @@
 6 # This plugin loads pyenv into the current shell and provides prompt info via
 7 # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
 8 
 9-# Load pyenv only if command not already available
10-if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then
11-  FOUND_PYENV=1
12-else
13+# Look for pyenv in $PATH and verify that it's not a part of pyenv-win in WSL
14+if ! command -v pyenv &>/dev/null; then
15+  FOUND_PYENV=0
16+elif [[ "${commands[pyenv]}" = */pyenv-win/* && "$(uname -r)" = *icrosoft* ]]; then
17   FOUND_PYENV=0
18+else
19+  FOUND_PYENV=1
20 fi
21 
22 # Look for pyenv and try to load it (will only work on interactive shells)