From c8169e703374ab9efa4facd0a06994a85b6f87c2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 15 Jan 2011 13:22:15 -0800 Subject: When killed by signal, return 128 + signum. This is the same convention that bash uses for returncodes of processes that are killed by signals. --- bin/portageq | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/portageq') diff --git a/bin/portageq b/bin/portageq index 547a70d6c..2f254ca81 100755 --- a/bin/portageq +++ b/bin/portageq @@ -1,24 +1,24 @@ #!/usr/bin/python -O -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function +import signal 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) + sys.exit(128 + signum) signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) except KeyboardInterrupt: - sys.exit(1) + sys.exit(128 + signal.SIGINT) import os import subprocess -- cgit v1.2.3-1-g7c22