Explorar el Código

Avoid infinite loop in case where `pwd` returns relative path

The `pwd` may return relative path if the `$PWD` is badly declared
in bash/zsh (e.g. `PWD="." bash`). To avoid the infinite loop in
`find_local_version_file()`, stop finding the version file if the
target paths are same consecutively.
pull/100/head
Yamashita Yuu hace 12 años
padre
commit
4c5ffc8d99
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. +3
    -2
      libexec/pyenv-version-file

+ 3
- 2
libexec/pyenv-version-file Ver fichero

@ -4,8 +4,8 @@ set -e
[ -n "$PYENV_DEBUG" ] && set -x
find_local_version_file() {
local root="$1"
while [ -n "$root" ]; do
local prev root="$1"
while [ -n "$root" ] && [ "$root" != "$prev" ]; do
if [ -e "${root}/.python-version" ]; then
echo "${root}/.python-version"
exit
@ -13,6 +13,7 @@ find_local_version_file() {
echo "${root}/.pyenv-version"
exit
fi
prev="${root}"
root="${root%/*}"
done
}

Cargando…
Cancelar
Guardar