procmail
[Top] [All Lists]

Re: capture exitcodes

2002-11-14 16:40:02
Tom Allison <tallison(_at_)tacocat(_dot_)net> writes:
I have an application that I want to use as a filter
but I also need to capture the exit code.
...
I can do:

:0 fw:
| foo-script
EXITCODE = $=

1) Don't use the variable 'EXITCODE' unless you want to affect the exit
   status of procmail itself.

2) The exit status of the last program executed by procmail is found in
   $?.  $= is the score of the last recipe.

3) Do you really need a locallockfile on that recipe?  Can only one copy
   of foo-script be running at any given moment?


What I need to do next is if EXITCODE <> 0, HALT.

        :0 fw:
        | foo-script

        status = $?

        :0
        * ! status ??? ^^0^^
        {
                # EXITCODE = whatever
                :0
                /dev/null
        }


I was king of hoping that if nothing came out of the filter it 
would not result in the immediate corruption of my mailbox.

With the 'w' flag on the recipe, procmail should 'roll-back' the change
made by the filter if the program exits with a non-zero status.  Is that
not happening for you?  What version of procmail are you using?

Note that it's not an error for a filter to return nothing if it exits
with status zero.


Philip Guenther

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>