summaryrefslogtreecommitdiffstats
path: root/pym/portage/package/ebuild/_ipc/ExitCommand.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/package/ebuild/_ipc/ExitCommand.py')
-rw-r--r--pym/portage/package/ebuild/_ipc/ExitCommand.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/pym/portage/package/ebuild/_ipc/ExitCommand.py b/pym/portage/package/ebuild/_ipc/ExitCommand.py
new file mode 100644
index 000000000..f14050b91
--- /dev/null
+++ b/pym/portage/package/ebuild/_ipc/ExitCommand.py
@@ -0,0 +1,27 @@
+# Copyright 2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.package.ebuild._ipc.IpcCommand import IpcCommand
+
+class ExitCommand(IpcCommand):
+
+ __slots__ = ('exitcode', 'reply_hook',)
+
+ def __init__(self):
+ IpcCommand.__init__(self)
+ self.reply_hook = None
+ self.exitcode = None
+
+ def __call__(self, argv):
+
+ if self.exitcode is not None:
+ # Ignore all but the first call, since if die is called
+ # then we certainly want to honor that exitcode, even
+ # the ebuild process manages to send a second exit
+ # command.
+ self.reply_hook = None
+ else:
+ self.exitcode = int(argv[1])
+
+ # (stdout, stderr, returncode)
+ return ('', '', 0)