From 2f52ca9dedae8f4e1fb144d54f9377ced3abd585 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 21 Jan 2016 13:32:22 +0800 Subject: [PATCH] update-bash: kill all of subprocess on interrupt when fetching --- Library/Homebrew/cmd/update-bash.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/update-bash.sh b/Library/Homebrew/cmd/update-bash.sh index d38d6dc72d..2b7e3d2339 100755 --- a/Library/Homebrew/cmd/update-bash.sh +++ b/Library/Homebrew/cmd/update-bash.sh @@ -293,6 +293,9 @@ EOS # this procedure will be removed in the future if it seems unnecessary rename_taps_dir_if_necessary + # kill all of subprocess on interrupt + trap '{ pkill -P $$; wait; exit 130; }' SIGINT + for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* do [[ -d "$DIR/.git" ]] || continue @@ -306,6 +309,7 @@ EOS done wait + trap - SIGINT for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* do