[issue12786] subprocess wait() hangs when stdin is closed

Ben Wolfson report at bugs.python.org
Fri Aug 19 20:14:14 CEST 2011


Ben Wolfson <wolfson at gmail.com> added the comment:

"The guys at #python-dev confirmed the same happens on 2.7 but not on 3.x."

Really? This is on gentoo, not debian, admittedly:

coelacanth ~ 11:12:36 $ python3
Python 3.1.3 (r313:86834, May  1 2011, 09:41:48) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> proc1 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)
>>> proc2 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)
>>> proc2.stdin.close()
>>> proc2.wait()
0
>>> 



coelacanth ~ 11:12:13 $ python3.1
Python 3.1.3 (r313:86834, May  1 2011, 09:41:48) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> proc1 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)
>>> proc2 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)
>>> proc1.stdin.close()
>>> proc1.wait()

[hangs]

----------
nosy: +Ben.Wolfson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12786>
_______________________________________


More information about the Python-bugs-list mailing list