Ensure that ^C interrupts are handled quietly.
authorZac Medico <zmedico@gentoo.org>
Fri, 23 Jun 2006 09:52:30 +0000 (09:52 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 23 Jun 2006 09:52:30 +0000 (09:52 -0000)
svn path=/main/trunk/; revision=3625

bin/emerge

index 319649ce8d02d7014d9ee914e6428fb4f881b8ed..a9ef2e6560255d85cbe69c041ab3ca38f3e7f175 100755 (executable)
@@ -3,15 +3,27 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+# This block ensures that ^C interrupts are handled quietly.
+try:
+       import signal
+
+       def exithandler(signum,frame):
+               signal.signal(signal.SIGINT, signal.SIG_IGN)
+               signal.signal(signal.SIGTERM, signal.SIG_IGN)
+               sys.exit(1)
+       
+       signal.signal(signal.SIGINT, exithandler)
+       signal.signal(signal.SIGTERM, exithandler)
+
+except KeyboardInterrupt:
+       sys.exit(1)
+
 import os,sys
 os.environ["PORTAGE_CALLER"]="emerge"
 sys.path = ["/usr/lib/portage/pym"]+sys.path
 import errno
 
-try:
-       import portage
-except KeyboardInterrupt:
-       sys.exit(1) # If they control C during imports, just die silently
+import portage
 
 import emergehelp, xpak, commands, re, signal, socket, string, time, types
 from stat import ST_MTIME