[issue10963] "subprocess" can raise OSError (EPIPE) when communicating with short-lived processes
Ross Lagerwall
report at bugs.python.org
Thu Mar 31 14:35:20 CEST 2011
Ross Lagerwall <rosslagerwall at gmail.com> added the comment:
I'd argue that this is not a feature request but a bug.
I did some testing of this issue and the problem is that EPIPE is only generated sometimes depending on the time the process takes to finish, the size of the data sent, the underlying mechanism used (select vs poll) and the whether anything happens between the starting of the process and the communicate() call.
Here are some results (on my PC, I think some of these will vary on others):
With poll:
[sys.executable, 'c', 'pass']- no error
['dd', 'option=bad'] - varies between EPIPE and no error
['dd', 'option=bad'], sleep(1) - EPIPE
With select:
[sys.executable, 'c', 'pass']- EPIPE
['dd', 'option=bad'] - EPIPE
['dd', 'option=bad'], sleep(1) - EPIPE
Only stdin (neither select or poll):
[sys.executable, 'c', 'pass']- no error (error in 2.7)
['dd', 'option=bad'] - no error (error in 2.7)
['dd', 'option=bad'], sleep(1) - EPIPE
(all of my tests appear to fail on Windows, they also generate EINVAL sometimes)
I think it's best to remove all this inconsistency and fix it so that EPIPE is never generated and then backport it to 2.7, 3.1, 3.2.
Attached is a patch which fixes it for poll, select, windows and adds two tests.
----------
nosy: +rosslagerwall
Added file: http://bugs.python.org/file21491/10963.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10963>
_______________________________________
More information about the Python-bugs-list
mailing list