Package portage :: Package util :: Package _async :: Module PopenProcess
[hide private]

Source Code for Module portage.util._async.PopenProcess

 1  # Copyright 2012 Gentoo Foundation 
 2  # Distributed under the terms of the GNU General Public License v2 
 3   
 4  from _emerge.SubProcess import SubProcess 
 5   
6 -class PopenProcess(SubProcess):
7 8 __slots__ = ("pipe_reader", "proc",) 9
10 - def _start(self):
11 12 self.pid = self.proc.pid 13 self._registered = True 14 15 if self.pipe_reader is None: 16 self._reg_id = self.scheduler.child_watch_add( 17 self.pid, self._child_watch_cb) 18 else: 19 try: 20 self.pipe_reader.scheduler = self.scheduler 21 except AttributeError: 22 pass 23 self.pipe_reader.addExitListener(self._pipe_reader_exit) 24 self.pipe_reader.start()
25
26 - def _pipe_reader_exit(self, pipe_reader):
27 self._reg_id = self.scheduler.child_watch_add( 28 self.pid, self._child_watch_cb)
29
30 - def _child_watch_cb(self, pid, condition, user_data=None):
31 self._reg_id = None 32 self._waitpid_cb(pid, condition) 33 self.wait()
34