From: Zac Medico Date: Sat, 19 Aug 2006 02:03:02 +0000 (-0000) Subject: Make sure that portageq exits quietly when killed, like emerge does. X-Git-Tag: v2.1.1~60 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f7c83c7f91546a1bd4faf5581a57e0df4ebe8120;p=portage.git Make sure that portageq exits quietly when killed, like emerge does. svn path=/main/trunk/; revision=4306 --- diff --git a/bin/portageq b/bin/portageq index ef05a28d7..f9527a253 100755 --- a/bin/portageq +++ b/bin/portageq @@ -3,7 +3,23 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import sys, os +import sys +# 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 os.environ["PORTAGE_CALLER"] = "portageq" sys.path = ["/usr/lib/portage/pym"]+sys.path