Quote:
Originally Posted by kovidgoyal
Hmm, would the file descriptors be inherited in child processes? If so, that is the perfect solution.
|
The usual problem here is not inheritance, it is too much inheritance. The implementation must ensure that only the 'right' descriptors are left open in the child. In a producer-consumer relationship, usually the child inherits the read pipe, and must not inherit the write pipe or it will never close. In all cases, the writer must have only the write end and the reader must have only the read end, or file close semantics will not be respected.
Both windows and *nix treat pipes as normal file descriptors with subprocess inheritance. I have used pipe inheritance in native code in both systems. I would be astonished if python doesn't support it. That said, I have been astonished before.