[Tests] bash_completion: don't let zsh's compinit wait for an answer

On runners where zsh considers a completion directory insecure,
`compinit` asks whether to use it, and on the test's terminal waited for an answer forever,
which hung every Ubuntu `fast` job.
The test now sets `ZSH_DISABLE_COMPFIX`, which `bash_completion` already honors, and gives zsh no stdin.
This commit is contained in:
Jordan Harband committed 2026-10-26 11:11:53 -07:00
1 parent 139ed9ccc6
commit 4007c0d062
1 file changed
+4 -3
@@ -44,15 +44,16 @@ complete_nvm() {
' bash "${NVM_SH}" "${BASH_COMPLETION}" "$@"
;;
zsh)
# bashcompinit runs `complete -F` functions from its `compgen`, under `emulate -L sh`
NVM_DIR="${TEST_DIR}/nvm" zsh -f -c '
# bashcompinit runs `complete -F` functions from its `compgen`, under `emulate -L sh`;
# without ZSH_DISABLE_COMPFIX, `compinit` asks about insecure completion directories, and waits
ZSH_DISABLE_COMPFIX=true NVM_DIR="${TEST_DIR}/nvm" zsh -f -c '
\. "${1}" --no-use
\. "${2}"
shift 2
COMP_WORDS=("${@}")
COMP_CWORD=$(($# - 1))
compgen -F __nvm -- "${@[-1]}"
' zsh "${NVM_SH}" "${BASH_COMPLETION}" "$@"
' zsh "${NVM_SH}" "${BASH_COMPLETION}" "$@" < /dev/null
;;
esac
) | LC_ALL=C sort