Fix errors when set -u is set in the user's shell (#350)

This commit is contained in:
Ville Skyttä
2022-10-12 07:41:29 +03:00
committed by GitHub
parent 9a57cd7711
commit 4054162a1c
2 changed files with 10 additions and 10 deletions

View File

@@ -129,7 +129,7 @@ esac
if [[ "$shell" != "fish" ]]; then
cat <<EOS
local ret=\$?
if [ -n "\$VIRTUAL_ENV" ]; then
if [ -n "\${VIRTUAL_ENV-}" ]; then
eval "\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
else
eval "\$(pyenv sh-activate --quiet || true)" || true
@@ -141,8 +141,8 @@ EOS
case "$shell" in
bash )
cat <<EOS
if ! [[ "\$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then
PROMPT_COMMAND="_pyenv_virtualenv_hook;\$PROMPT_COMMAND";
if ! [[ "\${PROMPT_COMMAND-}" =~ _pyenv_virtualenv_hook ]]; then
PROMPT_COMMAND="_pyenv_virtualenv_hook;\${PROMPT_COMMAND-}"
fi
EOS
;;