Fix incorrect IFS handling

The echo "${VIRTUALENV_PREFIX_PATHS[*]}" statement at the end of the file
only worked by accident because IFS=: was set earlier in the file.

Properly set/unset IFS.
This commit is contained in:
Sam Doran 2026-04-23 18:02:22 -04:00
parent 5ac3b3a1d9
commit c483e44cb4
No known key found for this signature in database
GPG key ID: 01602635F94328AA

View file

@ -26,13 +26,17 @@ if [ -z "$PYENV_ROOT" ]; then
PYENV_ROOT="${HOME}/.pyenv"
fi
OLDIFS="$IFS"
IFS=:
if [ -n "$1" ]; then
versions=($@)
IFS=: PYENV_VERSION="${versions[*]}"
# $@ is not affected by IFS
versions=("$@")
PYENV_VERSION="${versions[*]}"
export PYENV_VERSION
else
IFS=: versions=($(pyenv-version-name))
versions=($(pyenv-version-name))
fi
IFS="$OLDIFS"
append_virtualenv_prefix() {
if [ -d "${VIRTUALENV_PREFIX_PATH}" ]; then
@ -101,4 +105,7 @@ for version in "${versions[@]}"; do
fi
done
IFS=: echo "${VIRTUALENV_PREFIX_PATHS[*]}"
OLDIFS="$IFS"
IFS=:
echo "${VIRTUALENV_PREFIX_PATHS[*]}"
IFS="$OLDIFS"