[Fix] nvm debug: don't let the shell read stdin when asked for its version

busybox's shells have no `--version`, and start an interactive shell instead,
so with `$SHELL` set to busybox `sh` on a terminal, `nvm debug` waited for input forever,
which hung the alpine `sh` CI lanes in the "mirror URL credentials are masked in output" test.
Like the other busybox tools, its version now comes from `--help`,
and every shell is given no stdin to read.
This commit is contained in:
Jordan Harband committed 2026-10-25 11:42:45 -07:00
1 parent e780535240
commit 898124fd60
2 files changed
+66 -1

No files matched your search

+8 -1
View File
@@ -4268,7 +4268,14 @@ nvm() {
nvm_err "\${NPM_CONFIG_PREFIX}: '$(nvm_sanitize_path "${NPM_CONFIG_PREFIX-}")'"
nvm_err "\$NVM_NODEJS_ORG_MIRROR: '$(nvm_sanitize_url "${NVM_NODEJS_ORG_MIRROR-}")'"
nvm_err "\$NVM_IOJS_ORG_MIRROR: '$(nvm_sanitize_url "${NVM_IOJS_ORG_MIRROR-}")'"
nvm_err "shell version: '$(${SHELL} --version | command head -n 1)'"
local NVM_SHELL_VERSION
# busybox's shells have no `--version`, and start an interactive shell instead
if command ls -l "$(command -v "${SHELL}" 2>/dev/null)" 2>/dev/null | nvm_grep -q busybox; then
NVM_SHELL_VERSION="$(${SHELL} --help 2>&1 </dev/null | command head -n 1)"
else
NVM_SHELL_VERSION="$(${SHELL} --version </dev/null | command head -n 1)"
fi
nvm_err "shell version: '${NVM_SHELL_VERSION}'"
nvm_err "uname -a: '$(command uname -a | command awk '{$2=""; print}' | command xargs)'"
nvm_err "checksum binary: '$(nvm_get_checksum_binary 2>/dev/null)'"
if [ "$(nvm_get_os)" = "darwin" ] && nvm_has sw_vers; then