From 8392856ec5fb20024a2278d470a3b3190b97dee2 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Wed, 24 Jun 2020 05:16:23 -0700 Subject: [PATCH] Move trap statement up so it is seen before any exit command (#1215) --- src/gam-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gam-install.sh b/src/gam-install.sh index 3c2a2075..ff02161a 100755 --- a/src/gam-install.sh +++ b/src/gam-install.sh @@ -218,6 +218,10 @@ fi # Temp dir for archive #temp_archive_dir=$(mktemp -d) temp_archive_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir') + +# Clean up after ourselves even if we are killed with CTRL-C +trap "rm -rf $temp_archive_dir" EXIT + echo_yellow "Downloading file $name from $browser_download_url to $temp_archive_dir." # Save archive to temp w/o losing our path (cd $temp_archive_dir && curl -O -L $browser_download_url) @@ -372,6 +376,3 @@ echo_green "GAM installation and setup complete!" if [ "$update_profile" = true ]; then echo_green "Please restart your terminal shell or to get started right away run:\n\n$alias_line" fi - -# Clean up after ourselves even if we are killed with CTRL-C -trap "rm -rf $temp_archive_dir" EXIT