View Single Post
Old 06-22-2011, 02:43 PM   #17
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,456
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
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.
chaley is offline   Reply With Quote