From ded71fdf8d53f0bbd6a4a6f96f156bbc8ebf65e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 2 Feb 2022 15:02:31 +0100 Subject: [PATCH] Error in cleanupAndExit fixed Unmounted drive after we deleted the temporary items. Reversed order. --- fragments/functions.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index 647ef85..3abbdfb 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -1,19 +1,19 @@ # MARK: Functions cleanupAndExit() { # $1 = exit code, $2 message, $3 level - if [ "$DEBUG" -ne 1 ]; then - # remove the temporary working directory when done - printlog "Deleting $tmpDir" DEBUG - deleteTmpOut=$(rm -Rfv "$tmpDir") - printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG - fi - if [ -n "$dmgmount" ]; then # unmount disk image printlog "Unmounting $dmgmount" DEBUG unmountingOut=$(hdiutil detach "$dmgmount" 2>&1) printlog "Debugging enabled, Unmounting output was:\n$unmountingOut" DEBUG fi + if [ "$DEBUG" -ne 1 ]; then + # remove the temporary working directory when done (only if DEBUG is not used) + printlog "Deleting $tmpDir" DEBUG + deleteTmpOut=$(rm -Rfv "$tmpDir") + printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG + fi + # If we closed any processes, reopen the app again reopenClosedProcess if [[ -n $2 && $1 -ne 0 ]]; then