From e5bdad2201de45c203037e59491e4fea56def56d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 8 Jun 2017 18:34:30 +0200 Subject: bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2006) On Windows, subprocess.Popen.communicate() now also ignore EINVAL on stdin.write() if the child process is still running but closed the pipe. (cherry picked from commit d52aa31378ae43e044a300edfe8285954c167216) --- Lib/subprocess.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Lib/subprocess.py') diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c6ecc46186..4b41f5ec5c 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -720,10 +720,11 @@ class Popen(object): 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 + elif e.errno == errno.EINVAL: + # bpo-19612, bpo-30418: On Windows, stdin.write() + # fails with EINVAL if the child process exited or + # if the child process is still running but closed + # the pipe. pass else: raise -- cgit v1.2.1