summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-06 15:19:25 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-06 15:19:25 -0700
commitf5e237f6489f232ec5ada8566e4c35618e9e6d13 (patch)
tree4221cbacf7c6911b49d16dfd7b3ea6ad4d68c159
parentd08d8da197798a45c423dd0cf54c63a2badcb317 (diff)
downloadportage-f5e237f6489f232ec5ada8566e4c35618e9e6d13.tar.gz
portage-f5e237f6489f232ec5ada8566e4c35618e9e6d13.tar.bz2
portage-f5e237f6489f232ec5ada8566e4c35618e9e6d13.zip
Add FifoIpcDaemon._reopen_input() method.
-rw-r--r--pym/_emerge/EbuildIpcDaemon.py10
-rw-r--r--pym/_emerge/FifoIpcDaemon.py13
2 files changed, 14 insertions, 9 deletions
diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py
index e6ee82b1e..efcda9316 100644
--- a/pym/_emerge/EbuildIpcDaemon.py
+++ b/pym/_emerge/EbuildIpcDaemon.py
@@ -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]
diff --git a/pym/_emerge/FifoIpcDaemon.py b/pym/_emerge/FifoIpcDaemon.py
index b879fda95..ac83646b9 100644
--- a/pym/_emerge/FifoIpcDaemon.py
+++ b/pym/_emerge/FifoIpcDaemon.py
@@ -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