From d5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 18 Feb 2014 22:00:53 +0100 Subject: Issue #19612: On Windows, subprocess.Popen.communicate() now ignores OSError(22, 'Invalid argument') when writing input data into stdin, whereas the process already exited. --- Lib/subprocess.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Lib/subprocess.py') diff --git a/Lib/subprocess.py b/Lib/subprocess.py index d75a4e0404..86592a111d 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() -- cgit v1.2.1