Add FifoIpcDaemon._reopen_input() method.
authorZac Medico <zmedico@gentoo.org>
Wed, 6 Oct 2010 22:19:25 +0000 (15:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Oct 2010 00:22:04 +0000 (17:22 -0700)
pym/_emerge/EbuildIpcDaemon.py
pym/_emerge/FifoIpcDaemon.py

index e6ee82b1eb0ed673fa0304234223bf75486f0483..efcda93169ebb5d9161f7f2111e88d7f35a55b6f 100644 (file)
@@ -56,15 +56,7 @@ class EbuildIpcDaemon(FifoIpcDaemon):
                                pass
                        else:
 
-                               # Re-open the input stream, in order to suppress
-                               # POLLHUP events (bug #339976).
-                               self._files.pipe_in.close()
-                               input_fd = os.open(self.input_fifo, os.O_RDONLY|os.O_NONBLOCK)
-                               self._files.pipe_in = os.fdopen(input_fd, 'rb', 0)
-                               self.scheduler.unregister(self._reg_id)
-                               self._reg_id = self.scheduler.register(
-                                       self._files.pipe_in.fileno(),
-                                       self._registered_events, self._input_handler)
+                               self._reopen_input()
 
                                cmd_key = obj[0]
                                cmd_handler = self.commands[cmd_key]
index b879fda95ab71b3995dc29fb98190562fa32fe71..ac83646b9f17dd572a6a09c1055c989ffef297dd 100644 (file)
@@ -27,6 +27,19 @@ class FifoIpcDaemon(AbstractPollTask):
 
                self._registered = True
 
+       def _reopen_input(self):
+               """
+               Re-open the input stream, in order to suppress
+               POLLHUP events (bug #339976).
+               """
+               self._files.pipe_in.close()
+               input_fd = os.open(self.input_fifo, os.O_RDONLY|os.O_NONBLOCK)
+               self._files.pipe_in = os.fdopen(input_fd, 'rb', 0)
+               self.scheduler.unregister(self._reg_id)
+               self._reg_id = self.scheduler.register(
+                       self._files.pipe_in.fileno(),
+                       self._registered_events, self._input_handler)
+
        def isAlive(self):
                return self._registered