File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -593,9 +593,6 @@ def test_read_all_from_pipe_reader(self):
593
593
# of the data writter. Also we must explicitly attach a child
594
594
# watcher to the event loop.
595
595
596
- watcher = asyncio .get_child_watcher ()
597
- watcher .attach_loop (self .loop )
598
-
599
596
code = """\
600
597
import os, sys
601
598
fd = int(sys.argv[1])
@@ -611,9 +608,15 @@ def test_read_all_from_pipe_reader(self):
611
608
transport , _ = self .loop .run_until_complete (
612
609
self .loop .connect_read_pipe (lambda : protocol , pipe ))
613
610
614
- proc = self .loop .run_until_complete (
615
- asyncio .create_subprocess_exec (* args , pass_fds = {wfd }, loop = self .loop ))
616
- self .loop .run_until_complete (proc .wait ())
611
+ watcher = asyncio .SafeChildWatcher ()
612
+ watcher .attach_loop (self .loop )
613
+ try :
614
+ asyncio .set_child_watcher (watcher )
615
+ proc = self .loop .run_until_complete (
616
+ asyncio .create_subprocess_exec (* args , pass_fds = {wfd }, loop = self .loop ))
617
+ self .loop .run_until_complete (proc .wait ())
618
+ finally :
619
+ asyncio .set_child_watcher (None )
617
620
618
621
os .close (wfd )
619
622
data = self .loop .run_until_complete (reader .read (- 1 ))
You can’t perform that action at this time.
0 commit comments