diff options
author | Robby Workman <rworkman@slackware.com> | 2019-01-16 00:15:57 -0600 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2019-01-16 00:15:57 -0600 |
commit | c7216fb599374fee9833967e8a18d25e1348c4ba (patch) | |
tree | 481068379ff32535044508d76348bf148d7648c8 | |
parent | a9c7e7d4c7d40b36965bcf8a45419c2de6d04954 (diff) | |
download | slackpkg-c7216fb599374fee9833967e8a18d25e1348c4ba.tar.xz |
Catch errors and return exit status 1 if they occur
Thanks to mcandre on LQ for the suggestion.
-rw-r--r-- | files/core-functions.sh | 4 |
1 files changed, 3 insertions, 1 deletions
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 |