Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
edfdf547
Commit
edfdf547
authored
Jul 17, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Plain Diff
(Merge 3.4) asyncio, tulip issue 190: Process.communicate() now ignores
ConnectionResetError too
parents
0d35741b
d55b54d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
Doc/library/asyncio-subprocess.rst
Doc/library/asyncio-subprocess.rst
+5
-4
Lib/asyncio/subprocess.py
Lib/asyncio/subprocess.py
+7
-5
No files found.
Doc/library/asyncio-subprocess.rst
View file @
edfdf547
...
@@ -191,9 +191,9 @@ Process
...
@@ -191,9 +191,9 @@ Process
process, or ``None``, if no data should be sent to the child. The type
process, or ``None``, if no data should be sent to the child. The type
of *input* must be bytes.
of *input* must be bytes.
If a :exc:`BrokenPipeError`
is raised when writing *input* into stdin,
If a :exc:`BrokenPipeError`
or :exc:`ConnectionResetError` exception is
the exception is ignored. It occurs when the process exits before all
raised when writing *input* into stdin, the exception is ignored. It
data are written into stdin.
occurs when the process exits before all
data are written into stdin.
:meth:`communicate` returns a tuple ``(stdoutdata, stderrdata)``.
:meth:`communicate` returns a tuple ``(stdoutdata, stderrdata)``.
...
@@ -210,7 +210,8 @@ Process
...
@@ -210,7 +210,8 @@ Process
This method is a :ref:`coroutine <coroutine>`.
This method is a :ref:`coroutine <coroutine>`.
.. versionchanged:: 3.4.2
.. versionchanged:: 3.4.2
The method now ignores :exc:`BrokenPipeError`.
The method now ignores :exc:`BrokenPipeError` and
:exc:`ConnectionResetError`.
.. method:: kill()
.. method:: kill()
...
...
Lib/asyncio/subprocess.py
View file @
edfdf547
...
@@ -139,17 +139,19 @@ class Process:
...
@@ -139,17 +139,19 @@ class Process:
@
coroutine
@
coroutine
def
_feed_stdin
(
self
,
input
):
def
_feed_stdin
(
self
,
input
):
debug
=
self
.
_loop
.
get_debug
()
self
.
stdin
.
write
(
input
)
self
.
stdin
.
write
(
input
)
if
self
.
_loop
.
get_debug
()
:
if
debug
:
logger
.
debug
(
'%r communicate: feed stdin (%s bytes)'
,
logger
.
debug
(
'%r communicate: feed stdin (%s bytes)'
,
self
,
len
(
input
))
self
,
len
(
input
))
try
:
try
:
yield
from
self
.
stdin
.
drain
()
yield
from
self
.
stdin
.
drain
()
except
BrokenPipeError
:
except
(
BrokenPipeError
,
ConnectionResetError
)
as
exc
:
# ignore BrokenPipeError
# communicate() ignores BrokenPipeError and ConnectionResetError
pass
if
debug
:
logger
.
debug
(
'%r communicate: stdin got %r'
,
self
,
exc
)
if
self
.
_loop
.
get_debug
()
:
if
debug
:
logger
.
debug
(
'%r communicate: close stdin'
,
self
)
logger
.
debug
(
'%r communicate: close stdin'
,
self
)
self
.
stdin
.
close
()
self
.
stdin
.
close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment