mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-30418: Popen.communicate() always ignore EINVAL (#2002)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL on stdin.write() if the child process is still running but closed the pipe.
This commit is contained in:
parent
64505a1f6c
commit
d52aa31378
2 changed files with 11 additions and 6 deletions
|
@ -778,19 +778,21 @@ class Popen(object):
|
|||
self.stdin.write(input)
|
||||
except BrokenPipeError:
|
||||
pass # communicate() must ignore broken pipe errors.
|
||||
except OSError as e:
|
||||
if e.errno == errno.EINVAL and self.poll() is not None:
|
||||
# Issue #19612: On Windows, stdin.write() fails with EINVAL
|
||||
# if the process already exited before the write
|
||||
except OSError as exc:
|
||||
if exc.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
|
||||
|
||||
try:
|
||||
self.stdin.close()
|
||||
except BrokenPipeError:
|
||||
pass # communicate() must ignore broken pipe errors.
|
||||
except OSError as e:
|
||||
if e.errno == errno.EINVAL and self.poll() is not None:
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.EINVAL:
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
|
|
@ -350,6 +350,9 @@ Extension Modules
|
|||
Library
|
||||
-------
|
||||
|
||||
- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL
|
||||
on stdin.write() if the child process is still running but closed the pipe.
|
||||
|
||||
- bpo-30463: Addded empty __slots__ to abc.ABC. This allows subclassers
|
||||
to deny __dict__ and __weakref__ creation. Patch by Aaron Hall.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue