Skip to content

[Fix] nvm run: avoid an unbound NVM_IOJS under set -u - #3963

Open
jayhemnani9910 wants to merge 1 commit into
nvm-sh:masterfrom
jayhemnani9910:fix-run-nounset
Open

jayhemnani9910 wants to merge 1 commit into
nvm-sh:masterfrom
jayhemnani9910:fix-run-nounset

Conversation

@jayhemnani9910

Copy link
Copy Markdown

nvm run <version> only sets NVM_IOJS for io.js versions, then reads it, so in a script with set -u it aborts for any node version:

set -u
. "$NVM_DIR/nvm.sh"
nvm run 16 -e 'console.log(1)'
# nvm.sh: line 4970: NVM_IOJS: unbound variable

This picks up #3698 by @Deco: it sets the variable to false, in the two-line form requested there for ksh. Added a fast test that fails without the fix in bash and dash.

`nvm run <version>` read `NVM_IOJS` while it was only declared, so with
`set -u` it aborted with "NVM_IOJS: unbound variable" for any node version.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants