summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-29 00:04:54 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-29 00:04:54 +0200
commitc3828075598ca775555b29b78e67d3fa8e856c00 (patch)
tree300bc9a7ec1681fc4dc3d3c96f0c67d51977adee /Lib/subprocess.py
parent110796fb1588b1ab433f327f84175dffde229df8 (diff)
downloadcpython-git-c3828075598ca775555b29b78e67d3fa8e856c00.tar.gz
Issue #19612: subprocess.communicate() now also ignores EINVAL when using at
least two pipes.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index ce47b5e9ad..f9e9104d45 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1035,7 +1035,15 @@ class Popen(object):
try:
self.stdin.write(input)
except IOError as e:
- if e.errno != errno.EPIPE:
+ if e.errno == errno.EPIPE:
+ # communicate() should ignore broken pipe error
+ pass
+ elif (e.errno == errno.EINVAL
+ and self.poll() is not None):
+ # Issue #19612: stdin.write() fails with EINVAL
+ # if the process already exited before the write
+ pass
+ else:
raise
self.stdin.close()