summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-18 21:00:53 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-18 21:00:53 (GMT)
commitd5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25 (patch)
tree0d0c0102e3941fdb28ef698e1034049c542c759b /Lib/subprocess.py
parent9e5a9876ad3b666390f77aadfb02b303ff2748bd (diff)
downloadcpython-d5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25.zip
cpython-d5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25.tar.gz
cpython-d5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25.tar.bz2
Issue #19612: On Windows, subprocess.Popen.communicate() now ignores
OSError(22, 'Invalid argument') when writing input data into stdin, whereas the process already exited.
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 d75a4e0..86592a1 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1193,7 +1193,15 @@ class Popen(object):
try:
self.stdin.write(input)
except IOError as e:
- if e.errno != errno.EPIPE:
+ if e.errno == errno.EPIPE:
+ # ignore pipe full 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()