[PATCH aiaiai 5/7] aiaiai-email-test-patchset: correct hook calling to actually grab error
Keller, Jacob E
jacob.e.keller at intel.com
Mon Apr 7 14:14:15 PDT 2014
On Mon, 2014-04-07 at 13:08 +0300, Artem Bityutskiy wrote:
> On Fri, 2014-04-04 at 15:06 -0700, Jacob Keller wrote:
> > + # We have to disable exit-on-failure here, otherwise there is
> > no way to
> > + # grab the exit status of the hook. Using an if statement is
> > prone to
> > + # error because ! test in the if statement will change the
> > value of $?
> > + # accordingly. It's better to just disable failure here, and
> > then grab
> > + # the return value, checking only that.
> > + set +e
> > + "$hookscript" "$cfgfile" "$mbox" > "$hookoutput"
> > + hookret=$?
> > + set -e
>
> Would you please use the following construct instead:
>
> hookret=0
> "$hookscript" "$cfgfile" "$mbox" > "$hookoutput" || hookret="$?"
>
Are you sure that works? I did some experimenting and I thought I ended
up finding out this didn't work.... Maybe I didn't do it right though..
I tried again, and apparently it actually does work.. I'm not sure how I
ended up breaking it. I will redo to use this construct.
Thanks,
Jake
More information about the aiaiai
mailing list