Merge branch 'avoid-infinite-loop-even-if-pwd-returns-relative-path'
This commit is contained in:
commit
f956502fd8
@ -44,13 +44,13 @@ fi
|
|||||||
export PYENV_ROOT
|
export PYENV_ROOT
|
||||||
|
|
||||||
if [ -z "${PYENV_DIR}" ]; then
|
if [ -z "${PYENV_DIR}" ]; then
|
||||||
PYENV_DIR="$(abs_dirname "$(pwd)/..")"
|
PYENV_DIR="$(pwd)"
|
||||||
else
|
else
|
||||||
cd "$PYENV_DIR" 2>/dev/null || {
|
cd "$PYENV_DIR" 2>/dev/null || {
|
||||||
echo "pyenv: cannot change working directory to \`$PYENV_DIR'"
|
echo "pyenv: cannot change working directory to \`$PYENV_DIR'"
|
||||||
exit 1
|
exit 1
|
||||||
} >&2
|
} >&2
|
||||||
PYENV_DIR="$(abs_dirname "$(pwd)/..")"
|
PYENV_DIR="$(pwd)"
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
fi
|
fi
|
||||||
export PYENV_DIR
|
export PYENV_DIR
|
||||||
|
@ -4,8 +4,8 @@ set -e
|
|||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
find_local_version_file() {
|
find_local_version_file() {
|
||||||
local root="$1"
|
local prev root="$1"
|
||||||
while [ -n "$root" ]; do
|
while [ -n "$root" ] && [ "$root" != "$prev" ]; do
|
||||||
if [ -e "${root}/.python-version" ]; then
|
if [ -e "${root}/.python-version" ]; then
|
||||||
echo "${root}/.python-version"
|
echo "${root}/.python-version"
|
||||||
exit
|
exit
|
||||||
@ -13,6 +13,7 @@ find_local_version_file() {
|
|||||||
echo "${root}/.pyenv-version"
|
echo "${root}/.pyenv-version"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
prev="${root}"
|
||||||
root="${root%/*}"
|
root="${root%/*}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user