From f7c83c7f91546a1bd4faf5581a57e0df4ebe8120 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 19 Aug 2006 02:03:02 +0000 Subject: Make sure that portageq exits quietly when killed, like emerge does. svn path=/main/trunk/; revision=4306 --- bin/portageq | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-1-g7c22