Make work in nounset (-u) mode

This commit is contained in:
Ville Skyttä 2021-01-16 14:38:31 +02:00
parent 3fbbc155c7
commit f06fb60b1f
2 changed files with 4 additions and 4 deletions

View file

@ -49,7 +49,7 @@ if [ "$versions" = "--unset" ]; then
echo "set -e PYENV_VERSION"
;;
* )
echo 'PYENV_VERSION_OLD="$PYENV_VERSION"'
echo 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
echo "unset PYENV_VERSION"
;;
esac
@ -110,7 +110,7 @@ if pyenv-prefix "${versions[@]}" >/dev/null; then
echo "set -gx PYENV_VERSION \"$version\""
;;
* )
echo 'PYENV_VERSION_OLD="$PYENV_VERSION"'
echo 'PYENV_VERSION_OLD="${PYENV_VERSION-}"'
echo "export PYENV_VERSION=\"${version}\""
;;
esac

View file

@ -47,7 +47,7 @@ load test_helper
PYENV_SHELL=bash run pyenv-sh-shell --unset
assert_success
assert_output <<OUT
PYENV_VERSION_OLD="\$PYENV_VERSION"
PYENV_VERSION_OLD="\${PYENV_VERSION-}"
unset PYENV_VERSION
OUT
}
@ -75,7 +75,7 @@ SH
PYENV_SHELL=bash run pyenv-sh-shell 1.2.3
assert_success
assert_output <<OUT
PYENV_VERSION_OLD="\$PYENV_VERSION"
PYENV_VERSION_OLD="\${PYENV_VERSION-}"
export PYENV_VERSION="1.2.3"
OUT
}