mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Issue #12493: subprocess: communicate() handles EINTR
subprocess.Popen.communicate() now also handles EINTR errors if the process has only one pipe.
This commit is contained in:
parent
4c41f84033
commit
e790131dc6
3 changed files with 22 additions and 3 deletions
|
@ -476,7 +476,7 @@ def _eintr_retry_call(func, *args):
|
|||
while True:
|
||||
try:
|
||||
return func(*args)
|
||||
except OSError, e:
|
||||
except (OSError, IOError) as e:
|
||||
if e.errno == errno.EINTR:
|
||||
continue
|
||||
raise
|
||||
|
@ -743,10 +743,10 @@ class Popen(object):
|
|||
raise
|
||||
self.stdin.close()
|
||||
elif self.stdout:
|
||||
stdout = self.stdout.read()
|
||||
stdout = _eintr_retry_call(self.stdout.read)
|
||||
self.stdout.close()
|
||||
elif self.stderr:
|
||||
stderr = self.stderr.read()
|
||||
stderr = _eintr_retry_call(self.stderr.read)
|
||||
self.stderr.close()
|
||||
self.wait()
|
||||
return (stdout, stderr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue