From c7216fb599374fee9833967e8a18d25e1348c4ba Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Wed, 16 Jan 2019 00:15:57 -0600 Subject: Catch errors and return exit status 1 if they occur Thanks to mcandre on LQ for the suggestion. --- files/core-functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'files') diff --git a/files/core-functions.sh b/files/core-functions.sh index 19eebf3..fa02653 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -7,8 +7,10 @@ # Clean-up tmp and lock files # function cleanup() { + local retval=0 [ "$SPINNING" = "off" ] || tput cnorm if [ -e $TMPDIR/error.log ]; then + retval=1 echo -e " \n============================================================================== WARNING! WARNING! WARNING! WARNING! WARNING! @@ -24,7 +26,7 @@ One or more errors occurred while slackpkg was running: rm $CACHEPATH/$NAMEPKG &>/dev/null fi ( rm -f /var/lock/slackpkg.$$ && rm -rf $TMPDIR ) &>/dev/null - exit + exit ${retval} } trap 'cleanup' 2 14 15 # trap CTRL+C and kill -- cgit v1.2.3