Compare commits

...

3 Commits

Author SHA1 Message Date
ryenus
2977905670 [test] avoid leaking temp variable 2024-07-15 15:19:15 +08:00
ryenus
dffecf89bf ls-remote: introduce temp var for env inheritance
This is to inherit $NVM_MIN from env when defined, meanwhile avoiding
inline local variable initialization for ksh compatibility.

Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-07-15 14:55:33 +08:00
ryenus
547f50a137
avoid inline initialization for ksh compatibility
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-07-15 14:45:57 +08:00
2 changed files with 5 additions and 1 deletions

5
nvm.sh
View File

@ -4013,9 +4013,12 @@ nvm() {
;;
"ls-remote" | "list-remote")
local NVM_LTS
local NVM_MIN="${NVM_MIN-}"
local PATTERN
local NVM_NO_COLORS
local NVM_MIN_ENV
NVM_MIN_ENV="${NVM_MIN-}"
local NVM_MIN
NVM_MIN="${NVM_MIN_ENV-}"
while [ $# -gt 0 ]; do
case "${1-}" in

View File

@ -8,6 +8,7 @@ cleanup() {
unset -f nvm_remote_versions nvm_ls nvm_ls_current
if [ -n "$TEMP_NVM_MIN" ]; then
export NVM_MIN="$TEMP_NVM_MIN"
unset TEMP_NVM_MIN
fi
}