Python 2.0 - win32pipe routines inclusion for Windows

Niels Diepeveen niels at endea.demon.nl
Thu Jul 27 17:37:41 EDT 2000


David Bolen schreef:
> 
> But closing that hole at the application level isn't very difficult.
> The application needs to have processed all the child output (through
> knowledge of the child), or just explicitly closed the other files
> returned by the initial popen# call before doing the final close on
> the child-stdin to receive the exit code.

It is not only difficult but impossible to solve this at the application
level. The sort program does not (and can not) produce any output before
it reaches the end of its input. Many other programs behave less
extremely, but otherwise similarly, i.e. they will produce the final
part of their output only after the end of their input. There is no way
to force the end of that input other than by closing it. (at least not
on Unix, I expect it's similar on Windows)

I would propose waiting for the child to terminate and returning the
exit code only when closing the last remaining pipe, and returning None
on all the earlier closes. Is there any problem with that?

-- 
Niels Diepeveen
Endea automatisering




More information about the Python-list mailing list