summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-29 18:31:19 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-29 18:31:19 +0000
commit991773242ebdb8203b641d3c1db073b332485ef5 (patch)
tree4c92d9e75e276c01fcdbb85ab65d8c40007d4e2c
parentc58eaeef93c23cb13b4850b0b17f64eebca50082 (diff)
downloadportage-991773242ebdb8203b641d3c1db073b332485ef5.tar.gz
portage-991773242ebdb8203b641d3c1db073b332485ef5.tar.bz2
portage-991773242ebdb8203b641d3c1db073b332485ef5.zip
Add a quiet signal handler for SIGINT and SIGTERM since emerge calls ebuild
for fetchs and we don't want the user to see a traceback due to the ebuild process getting killed. svn path=/main/trunk/; revision=11268
-rwxr-xr-xbin/ebuild17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/ebuild b/bin/ebuild
index 76eb398c7..6a9bf601b 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -3,9 +3,24 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
+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 optparse
import os
-import sys
description = "See the ebuild(1) man page for more info"
usage = "Usage: ebuild <ebuild file> <command> [command] ..."