File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,21 +226,19 @@ def len_message(message):
226226 def test_cancel_process_wait (self ):
227227 # Issue #23140: cancel Process.wait()
228228
229- @asyncio .coroutine
230- def wait_proc (proc , event ):
231- event .set ()
232- yield from proc .wait ()
233-
234229 @asyncio .coroutine
235230 def cancel_wait ():
236231 proc = yield from asyncio .create_subprocess_exec (
237232 * PROGRAM_BLOCKED ,
238233 loop = self .loop )
239234
240235 # Create an internal future waiting on the process exit
241- event = asyncio .Event (loop = self .loop )
242- task = self .loop .create_task (wait_proc (proc , event ))
243- yield from event .wait ()
236+ task = self .loop .create_task (proc .wait ())
237+ self .loop .call_soon (task .cancel )
238+ try :
239+ yield from task
240+ except asyncio .CancelledError :
241+ pass
244242
245243 # Cancel the future
246244 task .cancel ()
You can’t perform that action at this time.
0 commit comments