diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-07-26 11:46:15 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-07-26 11:46:15 +0200 |
commit | 5377cc37c0f71fe22484303a4c6f387aa339f3f5 (patch) | |
tree | 5b6a26e596f83b83096b51b6ed370aee8422c0fa /plugins/pyenv | |
parent | c8a258698de6a56145211657f05f8b554a8140b7 (diff) | |
download | zsh-5377cc37c0f71fe22484303a4c6f387aa339f3f5.tar.gz zsh-5377cc37c0f71fe22484303a4c6f387aa339f3f5.tar.bz2 zsh-5377cc37c0f71fe22484303a4c6f387aa339f3f5.zip |
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.
Diffstat (limited to 'plugins/pyenv')
-rw-r--r-- | plugins/pyenv/pyenv.plugin.zsh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index fedde6342..813f64b42 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,11 +1,13 @@ # This plugin loads pyenv into the current shell and provides prompt info via # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available. -# Load pyenv only if command not already available -if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then - FOUND_PYENV=1 -else +# Look for pyenv in $PATH and verify that it's not a part of pyenv-win in WSL +if ! command -v pyenv &>/dev/null; then + FOUND_PYENV=0 +elif [[ "${commands[pyenv]}" = */pyenv-win/* && "$(uname -r)" = *icrosoft* ]]; then FOUND_PYENV=0 +else + FOUND_PYENV=1 fi # Look for pyenv and try to load it (will only work on interactive shells) |