From e8c8fd9b84ed48eb8d028f33d790c4f753f94326 Mon Sep 17 00:00:00 2001 From: native-api Date: Sun, 8 Dec 2024 23:30:27 +0300 Subject: [PATCH] Fix errorneously creating a symlink inside env directory if running with -f (#496) --- bin/pyenv-virtualenv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index a2a772c..16bb6c6 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -631,7 +631,8 @@ fi ## Create symlink in the `versions` directory for backward compatibility if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then - ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}" + # Overwrite an existing link, can happen if running with -f + ln -fsn "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}" fi if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then