]> granicus.if.org Git - python/commitdiff
asyncio: Fix race in subprocess transport, by Victor Stinner.
authorGuido van Rossum <guido@python.org>
Fri, 10 Jan 2014 21:28:59 +0000 (13:28 -0800)
committerGuido van Rossum <guido@python.org>
Fri, 10 Jan 2014 21:28:59 +0000 (13:28 -0800)
Lib/asyncio/unix_events.py

index eb3fb9f91c080a4249b1c09fbfe697e6f5a79976..80a98f806ef6cc5c64f25514227bcece47d222b6 100644 (file)
@@ -160,9 +160,10 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
             transp = _UnixSubprocessTransport(self, protocol, args, shell,
                                               stdin, stdout, stderr, bufsize,
                                               extra=None, **kwargs)
+            yield from transp._post_init()
             watcher.add_child_handler(transp.get_pid(),
                                       self._child_watcher_callback, transp)
-        yield from transp._post_init()
+
         return transp
 
     def _child_watcher_callback(self, pid, returncode, transp):