Bug #339976 - Suppress fifo POLLHUP events.
authorZac Medico <zmedico@gentoo.org>
Wed, 6 Oct 2010 21:53:57 +0000 (14:53 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 6 Oct 2010 21:53:57 +0000 (14:53 -0700)
pym/_emerge/EbuildIpcDaemon.py

index 0c8ea3ea8c5144b11218cf885c305c4b420e803d..e6ee82b1eb0ed673fa0304234223bf75486f0483 100644 (file)
@@ -55,6 +55,17 @@ class EbuildIpcDaemon(FifoIpcDaemon):
                                # any exception when given corrupt data.
                                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)
+
                                cmd_key = obj[0]
                                cmd_handler = self.commands[cmd_key]
                                reply = cmd_handler(obj)