get the return code when piping something to a python script?

BranoZ zarnovican at gmail.com
Tue Aug 16 20:38:31 CEST 2005


mhenry1384 wrote:
> On WinXP, I am doing this
>
> nant.exe | python MyFilter.py
>
> How do I set the return code from MyFilter.py based on the return of
> nant.exe?  Is this possible?

I don't know how it is on WinXP, but in UNIX you IMHO cannot easily
get the retcode of the peer _if_ the pipe was created by your common
parent, the shell. Only the parent knows retcodes of its children.

You can communicate the status over the pipe. E.g. when producer will
successufuly finish it will write (let say) last line with only one '.'

Didn't help you much..

BranoZ




More information about the Python-list mailing list