mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 07:36:16 -04:00
versions: fix portability regression in --executables
Commit 8037f226 introduced the `--executables` fast path using
`xargs -r` and `basename -a`. Those options are unavailable on
illumos and OpenBSD, breaking `pyenv rehash` on those platforms.
Replace the GNU-specific invocation with a Bash 3.2-compatible
implementation while preserving the direct executable discovery
optimization.
This commit is contained in:
parent
a33b30fa2d
commit
bb07d2e18a
|
|
@ -45,12 +45,10 @@ if [[ -n "$executables" ]]; then
|
|||
# Fast path for rehash: skip filtering and link resolution.
|
||||
# Discover executables directly from the versions directory and
|
||||
# deduplicate their basenames. Use bash 3.2 conventions to keep code portable.
|
||||
for path in \
|
||||
"$versions_dir"/*/bin/* \
|
||||
"$versions_dir"/*/envs/*/bin/*
|
||||
do
|
||||
printf '%s\n' "${path##*/}"
|
||||
done | sort -u
|
||||
paths=( "$versions_dir"/*/bin/* "$versions_dir"/*/envs/*/bin/* )
|
||||
if [ "${#paths[@]}" -gt 0 ]; then
|
||||
printf '%s\n' "${paths[@]##*/}" | sort -u
|
||||
fi
|
||||
shopt -u dotglob nullglob
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue