PopenProcess: child_watch_add if no pipe_reader
authorZac Medico <zmedico@gentoo.org>
Thu, 18 Oct 2012 01:23:11 +0000 (18:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 18 Oct 2012 01:23:11 +0000 (18:23 -0700)
pym/portage/util/_async/PopenProcess.py

index 37d32f26016281517d9565cfb135ec280fde7f9f..2fc56d2955b79bd42aaef1d6a34c8fc85d84bf2f 100644 (file)
@@ -7,13 +7,15 @@ class PopenProcess(SubProcess):
 
        __slots__ = ("pipe_reader", "proc",)
 
-       def __init__(self, **kwargs):
-               SubProcess.__init__(self, **kwargs)
+       def _start(self):
+
                self.pid = self.proc.pid
                self._registered = True
 
-       def _start(self):
-               if self.pipe_reader is not None:
+               if self.pipe_reader is None:
+                       self._reg_id = self.scheduler.child_watch_add(
+                               self.pid, self._child_watch_cb)
+               else:
                        try:
                                self.pipe_reader.scheduler = self.scheduler
                        except AttributeError: