[docs] [issue9127] subprocess.Popen.communicate() and SIGCHLD handlers
Benjamin Ryzman
report at bugs.python.org
Wed Jun 30 17:59:32 CEST 2010
Benjamin Ryzman <benjamin+python at ryzman.fr> added the comment:
Content of the above pastie:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> import subprocess
>>> signal.signal(signal.SIGCHLD,signal.SIG_IGN)
0
>>> subprocess.Popen(["echo","blah"], stdout=subprocess.PIPE).communicate()[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/subprocess.py", line 698, in communicate
self.wait()
File "/usr/lib/python2.6/subprocess.py", line 1170, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib/python2.6/subprocess.py", line 465, in _eintr_retry_call
return func(*args)
OSError: [Errno 10] No child processes
>>> oldsignal = signal.signal(signal.SIGCHLD,signal.SIG_DFL)
>>> subprocess.Popen(["echo","blah"], stdout=subprocess.PIPE).communicate()[0]
'blah\n'
>>> signal.signal(signal.SIGCHLD,oldsignal)
0
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9127>
_______________________________________
More information about the docs
mailing list