From 52cb0b10867e087c3039ae29eb63dcef9f609663 Mon Sep 17 00:00:00 2001 From: Chris Larsen Date: Fri, 8 Sep 2017 15:21:44 -0600 Subject: [PATCH] evaluate force flag before testing if venv exists fixes #161, fixes #187 --- bin/pyenv-virtualenv | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index f918162..d4fcc4e 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -349,9 +349,11 @@ if [[ "${VIRTUALENV_PATH/*/envs/*}" != "${PYENV_ROOT}/versions" ]]; then fi if [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then - if [ -e "${COMPAT_VIRTUALENV_PATH}" ] || [ -L "${COMPAT_VIRTUALENV_PATH}" ]; then - echo "pyenv-virtualenv: \`${COMPAT_VIRTUALENV_PATH}' already exists." 1>&2 - exit 1 + if [ -z ${FORCE} ]; then + if [ -e "${COMPAT_VIRTUALENV_PATH}" ] || [ -L "${COMPAT_VIRTUALENV_PATH}" ]; then + echo "pyenv-virtualenv: \`${COMPAT_VIRTUALENV_PATH}' already exists." 1>&2 + exit 1 + fi fi fi