1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 06:13:53 -05:00

Handle case where pyenv-commands --sh returns nothing (#2908)

In exceptional cases (custom installation, malfunctions elsewhere), `pyenv-commands --sh` may return nothing.
In non-Fish, this would cause "syntax error near unexpected token `)'" in `pyenv()`.

Bash does not allow to specify a `case` option that would never match.
This works around it by defaulting to `/`. Commands, being filenames, can never match it.
In Fish, nothing needs to be done: it apparently does interpret a `case` without argument as one that never matches.
This commit is contained in:
Alex Hedges
2024-02-25 16:07:52 -05:00
committed by GitHub
parent f9a2bb81b6
commit 02e1d4a293
2 changed files with 31 additions and 1 deletions

View File

@@ -297,7 +297,7 @@ EOS
fi
case "\$command" in
${commands[*]})
${commands[*]:-/})
eval "\$(pyenv "sh-\$command" "\$@")"
;;
*)