From 745291dcf20686ec421935f1c3f8f3a2918dd106 Mon Sep 17 00:00:00 2001 From: Sumit Sahrawat Date: Thu, 13 Jul 2023 17:44:12 +0530 Subject: [PATCH] Fix leaking variables using `local` with for loops (#98) --- zsh-nvm.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index d85e94c..f4f56f3 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -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