Skip to content

Commit

Permalink
fix(pyenv): fix for ignoring pyenv-win commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mcornella committed Jul 26, 2021
1 parent c8a2586 commit 5377cc3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/pyenv/pyenv.plugin.zsh
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 5377cc3

Please sign in to comment.