]> mj.ucw.cz Git - moe.git/commitdiff
Handle exit code translation failures gracefully.
authorMartin Mares <mj@ucw.cz>
Sun, 2 Nov 2008 20:12:43 +0000 (21:12 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 2 Nov 2008 20:12:43 +0000 (21:12 +0100)
Apparantly, "X=`false`" fails with a non-zero exit code
(and the script stops), even though "echo `false`" doesn't.

eval/libeval.sh

index 6d2ffb1932bea9a0ad7232e2dbbfd0a27aedd051..2bb84bb61cde45b77e66eb6a6d02c540bed3f376 100644 (file)
@@ -263,14 +263,14 @@ function test-result
        SG=${M#Caught fatal signal }
        SG=${SG#Committed suicide by signal }
        if [ "$SG" != "$M" ] ; then
-               SG=`kill -l $SG 2>/dev/null`
+               SG=`kill -l $SG 2>/dev/null` || SG=
                [ -z "$SG" ] || M="$M (SIG$SG)"
        fi
 
        # Translate runtime errors to readable strings
        RE=${M#Exited with error status }
        if [ -n "$EXIT_CODE_HOOK" -a "$RE" != "$M" ] ; then
-               NEWMSG=`$EXIT_CODE_HOOK $RE`
+               NEWMSG=`$EXIT_CODE_HOOK $RE` || NEWMSG=
                if [ -n "$NEWMSG" ] ; then
                        M="Runtime error $RE: $NEWMSG"
                fi