Skip to content

Commit e0f41f1

Browse files
committed
Fix potential issue that would create a nested symlink
1 parent 651da7b commit e0f41f1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bin/common/.local/bin/pyswitch

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ venv_src="$VENV_INSTALL_DIR/global-$version"
1616
venv_dst="$HOME/.venv"
1717

1818
# Remove the global venv first since `uv python find` would match it.
19-
rm -f "$venv_dst"
19+
if [ -L "$venv_dst" ]; then
20+
rm -f "$venv_dst"
21+
elif [ -d "$venv_dst" ]; then
22+
rm -rf "$venv_dst"
23+
fi
2024
bin="$(uv python find "$version")"
2125

2226
# Create a venv for this version and symlink it into HOME so that uv can find it.

0 commit comments

Comments
 (0)