Issue #19612: On Windows, subprocess.Popen.communicate() now ignores

OSError(22, 'Invalid argument') when writing input data into stdin, whereas
the process already exited.
This commit is contained in:
Victor Stinner 2014-02-18 22:00:53 +01:00
parent 9e5a9876ad
commit d5c8ce7cc0
2 changed files with 14 additions and 2 deletions

View File

@ -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()

View File

@ -20,6 +20,10 @@ Core and Builtins
Library
-------
- Issue #19612: On Windows, subprocess.Popen.communicate() now ignores
OSError(22, 'Invalid argument') when writing input data into stdin, whereas
the process already exited.
- Issue #6815: os.path.expandvars() now supports non-ASCII environment
variables names and values.