Martin Panter <vadmium...@gmail.com> added the comment:

The "grep" process may be closing its end of the pipe before it exits. Or if 
Grep leaves the pipe open when it exits, the OS may close the pipe before it 
makes the child exit status available. Either way, I suspect "p.stdout.read()" 
returns an empty string indicating the pipe is closed, but "p.poll()" returns 
None because the exit status is not yet ready. Even if it is the OS closing the 
pipe after the child exits, I doubt there is any guarantee about when that 
happens relative to the child's exit status becoming available.

The "poll" method does not wait for the child to exit. Normally you use the 
"wait" method in this situation. I suspect this is a bug in the application, 
not in Python.

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34566>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to