summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-01-15 13:22:15 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-16 12:33:20 -0800
commitc8169e703374ab9efa4facd0a06994a85b6f87c2 (patch)
treeb51d7e40fbf7915d046045422009ba1d0e8700ec /bin
parentb512bca8bf2ef6c1ce57d134653bde909cd986f5 (diff)
downloadportage-c8169e703374ab9efa4facd0a06994a85b6f87c2.tar.gz
portage-c8169e703374ab9efa4facd0a06994a85b6f87c2.tar.bz2
portage-c8169e703374ab9efa4facd0a06994a85b6f87c2.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')
-rwxr-xr-xbin/ebuild8
-rwxr-xr-xbin/egencache8
-rwxr-xr-xbin/emerge8
-rwxr-xr-xbin/portageq8
-rwxr-xr-xbin/repoman8
5 files changed, 21 insertions, 19 deletions
diff --git a/bin/ebuild b/bin/ebuild
index 87d974e48..ab88d6a30 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -1,18 +1,18 @@
#!/usr/bin/python -O
-# Copyright 1999-2010 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)
@@ -21,7 +21,7 @@ try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except KeyboardInterrupt:
- sys.exit(1)
+ sys.exit(128 + signal.SIGINT)
def debug_signal(signum, frame):
import pdb
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
diff --git a/bin/emerge b/bin/emerge
index 5d74bfa00..6f69244be 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1,18 +1,18 @@
#!/usr/bin/python
-# Copyright 2006-2009 Gentoo Foundation
+# Copyright 2006-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)
@@ -21,7 +21,7 @@ try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except KeyboardInterrupt:
- sys.exit(1)
+ sys.exit(128 + signal.SIGINT)
def debug_signal(signum, frame):
import pdb
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
diff --git a/bin/repoman b/bin/repoman
index 3938f49cf..dd2b774e8 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1,5 +1,5 @@
#!/usr/bin/python -O
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Next to do: dep syntax checking in mask files
@@ -113,8 +113,10 @@ def err(txt):
def exithandler(signum=None, frame=None):
logging.fatal("Interrupted; exiting...")
- sys.exit(1)
- os.kill(0, signal.SIGKILL)
+ if signum is None:
+ sys.exit(1)
+ else:
+ sys.exit(128 + signum)
signal.signal(signal.SIGINT,exithandler)