summaryrefslogtreecommitdiffstats
path: root/files/core-functions.sh
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2019-01-16 00:15:57 -0600
committerRobby Workman <rworkman@slackware.com>2019-01-16 00:15:57 -0600
commitc7216fb599374fee9833967e8a18d25e1348c4ba (patch)
tree481068379ff32535044508d76348bf148d7648c8 /files/core-functions.sh
parenta9c7e7d4c7d40b36965bcf8a45419c2de6d04954 (diff)
downloadslackpkg-c7216fb599374fee9833967e8a18d25e1348c4ba.tar.xz
Catch errors and return exit status 1 if they occur
Thanks to mcandre on LQ for the suggestion.
Diffstat (limited to 'files/core-functions.sh')
-rw-r--r--files/core-functions.sh4
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