@@ -214,23 +214,15 @@ def _process_exited(self, returncode):
214
214
# asyncio uses a child watcher: copy the status into the Popen
215
215
# object. On Python 3.6, it is required to avoid a ResourceWarning.
216
216
self ._proc .returncode = returncode
217
-
218
- def __process_exited ():
219
- self ._protocol .process_exited ()
220
- # Since process exited, clear all pipes
221
- for proto in self ._pipes .values ():
222
- if proto is None :
223
- continue
224
- proto .pipe .close ()
225
- # Call _wait waiters
226
- for waiter in self ._exit_waiters :
227
- if not waiter .cancelled ():
228
- waiter .set_result (self ._returncode )
229
- self ._exit_waiters = None
230
-
231
- self ._call (__process_exited )
217
+ self ._call (self ._protocol .process_exited )
232
218
self ._try_finish ()
233
219
220
+ # wake up futures waiting for wait()
221
+ for waiter in self ._exit_waiters :
222
+ if not waiter .cancelled ():
223
+ waiter .set_result (returncode )
224
+ self ._exit_waiters = None
225
+
234
226
async def _wait (self ):
235
227
"""Wait until the process exit and return the process return code.
236
228
@@ -260,7 +252,6 @@ def _call_connection_lost(self, exc):
260
252
self ._protocol = None
261
253
262
254
263
-
264
255
class WriteSubprocessPipeProto (protocols .BaseProtocol ):
265
256
266
257
def __init__ (self , proc , fd ):
0 commit comments