[PATCH aiaiai 5/7] aiaiai-email-test-patchset: correct hook calling to actually grab error

Artem Bityutskiy dedekind1 at gmail.com
Mon Apr 7 03:08:46 PDT 2014


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="$?"

-- 
Best Regards,
Artem Bityutskiy




More information about the aiaiai mailing list