mirror of
https://github.com/rworkman/slackpkg
synced 2025-01-13 20:03:38 +01:00
Catch errors and return exit status 1 if they occur
Thanks to mcandre on LQ for the suggestion.
This commit is contained in:
parent
a9c7e7d4c7
commit
c7216fb599
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue