From: Zac Medico Date: Fri, 23 Jun 2006 09:52:30 +0000 (-0000) Subject: Ensure that ^C interrupts are handled quietly. X-Git-Tag: v2.1.1~412 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=75784ffb415bd299009cb553b76ec0381b32a3a0;p=portage.git Ensure that ^C interrupts are handled quietly. svn path=/main/trunk/; revision=3625 --- diff --git a/bin/emerge b/bin/emerge index 319649ce8..a9ef2e656 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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