1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-17 19:30:10 +00:00

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.
This commit is contained in:
Marc Cornellà 2021-07-26 11:46:15 +02:00
parent c8a258698d
commit 5377cc37c0
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -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)