Skip to content

Commit

Permalink
Merge pull request pyenv#1786 from scop/nounset
Browse files Browse the repository at this point in the history
Make work in nounset (-u) mode
  • Loading branch information
anton-petrov authored Feb 28, 2021
2 parents 338c366 + f06fb60 commit ec2d2b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libexec/pyenv-sh-shell
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/shell.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ec2d2b9

Please sign in to comment.