Fix "cd: null directory" in tests in OpenSUSE

This commit is contained in:
Ivan Pozdeev 2026-08-25 18:08:48 +03:00
parent 0f16606e4f
commit e613234196

View file

@ -38,7 +38,9 @@ find_local_version_file() {
if [ -n "$target_dir" ]; then
find_local_version_file "$target_dir"
else
find_local_version_file "$PYENV_DIR" || {
# In tests, PYENV_DIR is not set, ultimately leading to "cd: null directory" in OpenSUSE
# While most `cd` implemntations treat an empty argument the same as missing, that's still wrong
find_local_version_file "${PYENV_DIR:=$PWD}" || {
[ "$PYENV_DIR" != "$PWD" ] && find_local_version_file "$PWD"
} || echo "${PYENV_ROOT}/version"
fi