Exclude .dylib from pyenv-commands

Since it's not actually a command, but a binary lib, and better avoid it
unexpectedly appearing in `commands`.
This commit is contained in:
Andrej730 committed 2026-10-29 21:33:21 +05:00
1 parent 0dea25c4b3
commit cf4d2f13e1
2 files changed
+13

No files matched your search

+1
View File
@@ -39,6 +39,7 @@ shopt -s nullglob
else
for path in "${paths[@]}"; do
for command in "${path}"/pyenv-*; do
[[ $command == *.dylib ]] && continue
command="${command##*/pyenv-}"
if [[ -n $nosh ]]; then
if [[ ${command:0:3} != "sh-" ]]; then
+12
View File
@@ -31,6 +31,18 @@ load test_helper
assert_line "hello"
}
@test "commands excludes .dylib files" {
path="${PYENV_TEST_DIR}/commands"
mkdir -p "$path"
touch "${path}/pyenv-hello" "${path}/pyenv-realpath.dylib"
chmod +x "${path}/pyenv-hello" "${path}/pyenv-realpath.dylib"
PATH="${path}:$PATH" run pyenv-commands
assert_success
assert_line "hello"
refute_line "realpath.dylib"
}
@test "commands --no-sh" {
run pyenv-commands --no-sh
assert_success