mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-16 07:13:53 -05:00
Fix resolution of a name that's a prefix of another name (#2521)
This commit is contained in:
@@ -35,6 +35,12 @@ IFS=$'\n'
|
||||
else
|
||||
DEFINITION_CANDIDATES=( $(python-build --definitions ) )
|
||||
fi
|
||||
|
||||
if printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | grep -qxFe "$prefix"; then
|
||||
echo "$prefix"
|
||||
exit $exitcode;
|
||||
fi
|
||||
|
||||
# https://stackoverflow.com/questions/11856054/is-there-an-easy-way-to-pass-a-raw-string-to-grep/63483807#63483807
|
||||
prefix_re="$(sed 's/[^\^]/[&]/g;s/[\^]/\\&/g' <<< "$prefix")"
|
||||
# FIXME: more reliable and readable would probably be to loop over them and transform in pure Bash
|
||||
|
||||
Reference in New Issue
Block a user