diff --git a/libexec/pyenv-prefix b/libexec/pyenv-prefix index 9b73795e..ac04f6bc 100755 --- a/libexec/pyenv-prefix +++ b/libexec/pyenv-prefix @@ -32,6 +32,7 @@ OLDIFS="$IFS" if [ "$version" = "system" ]; then if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)"; then PYENV_PREFIX_PATH="${PYTHON_PATH%/bin/*}" + PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}" else echo "pyenv: system version not found in PATH" >&2 exit 1 diff --git a/test/prefix.bats b/test/prefix.bats index be9dbaed..6f63d1f7 100644 --- a/test/prefix.bats +++ b/test/prefix.bats @@ -24,6 +24,18 @@ load test_helper assert_success "$PYENV_TEST_DIR" } +@test "prefix for system in /" { + mkdir -p "${BATS_TEST_DIRNAME}/libexec" + cat >"${BATS_TEST_DIRNAME}/libexec/pyenv-which" <