diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-08-19 02:03:02 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-08-19 02:03:02 +0000 |
commit | f7c83c7f91546a1bd4faf5581a57e0df4ebe8120 (patch) | |
tree | a169fdc947c2f857fb28fd260fbd3fbc1d232cdc | |
parent | 1632b7d2b123445ff109dfe4dad5b8094c997ed3 (diff) | |
download | portage-f7c83c7f91546a1bd4faf5581a57e0df4ebe8120.tar.gz portage-f7c83c7f91546a1bd4faf5581a57e0df4ebe8120.tar.bz2 portage-f7c83c7f91546a1bd4faf5581a57e0df4ebe8120.zip |
Make sure that portageq exits quietly when killed, like emerge does.
svn path=/main/trunk/; revision=4306
-rwxr-xr-x | bin/portageq | 18 |
1 files changed, 17 insertions, 1 deletions
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 |