diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-12 22:08:56 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-12 22:08:56 -0700 |
commit | 15e1a041ddd6bdbc6dc30b350e16c864f8d4c334 (patch) | |
tree | b610acace1e39295f7489abf88f9c8d8cb067bd6 /pym/_emerge/EbuildIpcDaemon.py | |
parent | 6451c6cbde1fa91cf15fa03f79bfbd421329ba2c (diff) | |
download | portage-15e1a041ddd6bdbc6dc30b350e16c864f8d4c334.tar.gz portage-15e1a041ddd6bdbc6dc30b350e16c864f8d4c334.tar.bz2 portage-15e1a041ddd6bdbc6dc30b350e16c864f8d4c334.zip |
Make IpcDaemonTestCase demonstrate an EbuildIpcDaemon based
replacement for EBUILD_EXIT_STATUS_FILE.
Diffstat (limited to 'pym/_emerge/EbuildIpcDaemon.py')
-rw-r--r-- | pym/_emerge/EbuildIpcDaemon.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py index 48f58224b..2f4d8933c 100644 --- a/pym/_emerge/EbuildIpcDaemon.py +++ b/pym/_emerge/EbuildIpcDaemon.py @@ -24,7 +24,7 @@ class EbuildIpcDaemon(FifoIpcDaemon): left orphan processes running in the backgraound (as in bug 278895). """ - __slots__ = () + __slots__ = ('commands',) def _input_handler(self, fd, event): @@ -38,15 +38,15 @@ class EbuildIpcDaemon(FifoIpcDaemon): if buf: obj = pickle.loads(buf.tostring()) - if isinstance(obj, list) and \ - obj and \ - obj[0] == 'exit': - output_fd = os.open(self.output_fifo, os.O_WRONLY|os.O_NONBLOCK) - output_file = os.fdopen(output_fd, 'wb') - pickle.dump('OK', output_file) - output_file.close() - self._unregister() - self.wait() + cmd_key = obj[0] + cmd_handler = self.commands[cmd_key] + cmd_handler(obj, self._send_reply) self._unregister_if_appropriate(event) return self._registered + + def _send_reply(self, reply): + output_fd = os.open(self.output_fifo, os.O_WRONLY|os.O_NONBLOCK) + output_file = os.fdopen(output_fd, 'wb') + pickle.dump(reply, output_file) + output_file.close() |