summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-23 10:22:59 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-23 10:22:59 +0000
commit69b4be98e3c89de4aee5aaeffced418844481487 (patch)
tree00cb2bfe6439101fd5cc3caf7f9498627884eba0
parent32edf201d5c10fbe13f1e50f02741b5214282e39 (diff)
downloadportage-69b4be98e3c89de4aee5aaeffced418844481487.tar.gz
portage-69b4be98e3c89de4aee5aaeffced418844481487.tar.bz2
portage-69b4be98e3c89de4aee5aaeffced418844481487.zip
Register emerge exit and signal handlers after parsing options, just before the action phase.
svn path=/main/trunk/; revision=3627
-rwxr-xr-xbin/emerge31
1 files changed, 16 insertions, 15 deletions
diff --git a/bin/emerge b/bin/emerge
index 3ec1223a3..70385e5ad 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -245,21 +245,6 @@ def emergelog(mystr,short_msg=None):
if secpass >= 1:
print >> sys.stderr, "emergelog():",e
-def emergeexit():
- """This gets out final log message in before we quit."""
- if "--pretend" not in myopts:
- emergelog(" *** terminating.")
- if "notitles" not in portage.settings.features:
- xtermTitleReset()
-portage.atexit_register(emergeexit)
-
-def emergeexitsig(signum, frame):
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- portage.portageexit()
- portage_util.writemsg("\n\nExiting on signal %(signal)s\n" % {"signal":signum})
- sys.exit(100+signum)
-signal.signal(signal.SIGINT, emergeexitsig)
-
def countdown(secs=5, doing="Starting"):
if secs:
print ">>> Waiting",secs,"seconds before starting..."
@@ -3646,6 +3631,22 @@ if __name__ == "__main__":
if "--debug" in myopts:
edebug=1
+ def emergeexitsig(signum, frame):
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ signal.signal(signal.SIGTERM, signal.SIG_IGN)
+ portage_util.writemsg("\n\nExiting on signal %(signal)s\n" % {"signal":signum})
+ sys.exit(100+signum)
+ signal.signal(signal.SIGINT, emergeexitsig)
+ signal.signal(signal.SIGTERM, emergeexitsig)
+
+ def emergeexit():
+ """This gets out final log message in before we quit."""
+ if "--pretend" not in myopts:
+ emergelog(" *** terminating.")
+ if "notitles" not in portage.settings.features:
+ xtermTitleReset()
+ portage.atexit_register(emergeexit)
+
if myaction in ["sync","metadata"] and "--help" not in myopts:
if "--pretend" in myopts:
print "emerge: \"sync\" actions do not support \"--pretend.\""