From ed779fea143e601864f3524e33b98885c6fb3c19 Mon Sep 17 00:00:00 2001 From: Luis Marsano Date: Fri, 16 Nov 2018 04:38:26 -0500 Subject: [PATCH] cleanup `pyenv virtualenv` on ERR also cleanup compatibility paths --- bin/pyenv-virtualenv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index 84cf37d..a250658 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -537,10 +537,11 @@ for hook in "${before_hooks[@]}"; do eval "$hook"; done # Plan cleanup on unsuccessful installation. cleanup() { + [[ -L "${COMPAT_VIRTUALENV_PATH}" ]] && rm "${COMPAT_VIRTUALENV_PATH}" [ -z "${PREFIX_EXISTS}" ] && rm -rf "$VIRTUALENV_PATH" } -trap cleanup SIGINT +trap cleanup SIGINT ERR # Invoke virtualenv and record exit status in $STATUS. STATUS=0