diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-01-15 13:22:15 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-01-15 13:22:15 -0800 |
commit | e2a3237b4018e274350488868577c4d74a496b85 (patch) | |
tree | 63b430077d0ed8ca07ee87e82a506269ced09948 /bin/egencache | |
parent | f680d640ec0bf92ab5506090ee662338b4276ab7 (diff) | |
download | portage-e2a3237b4018e274350488868577c4d74a496b85.tar.gz portage-e2a3237b4018e274350488868577c4d74a496b85.tar.bz2 portage-e2a3237b4018e274350488868577c4d74a496b85.zip |
When killed by signal, return 128 + signum.
This is the same convention that bash uses for returncodes of
processes that are killed by signals.
Diffstat (limited to 'bin/egencache')
-rwxr-xr-x | bin/egencache | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/egencache b/bin/egencache index c01ced058..2fb30a07c 100755 --- a/bin/egencache +++ b/bin/egencache @@ -1,24 +1,24 @@ #!/usr/bin/python -# Copyright 2009-2010 Gentoo Foundation +# Copyright 2009-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 codecs import logging |