Fix leaking variables using local with for loops (#98)

This commit is contained in:
Sumit Sahrawat 2023-07-13 17:44:12 +05:30 committed by Eric Henderson
parent e293a0914f
commit d3db5265b5

View File

@ -98,11 +98,13 @@ _zsh_nvm_lazy_load() {
# Remove any binaries that conflict with current aliases
local cmds
cmds=()
local bin
for bin in $global_binaries; do
[[ "$(which $bin 2> /dev/null)" = "$bin: aliased to "* ]] || cmds+=($bin)
done
# Create function for each command
local cmd
for cmd in $cmds; do
# When called, unset all lazy loaders, load nvm then run current command