1 |
Author: zmedico |
2 |
Date: 2008-07-29 18:31:19 +0000 (Tue, 29 Jul 2008) |
3 |
New Revision: 11268 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/ebuild |
7 |
Log: |
8 |
Add a quiet signal handler for SIGINT and SIGTERM since emerge calls ebuild |
9 |
for fetchs and we don't want the user to see a traceback due to the ebuild |
10 |
process getting killed. |
11 |
|
12 |
|
13 |
Modified: main/trunk/bin/ebuild |
14 |
=================================================================== |
15 |
--- main/trunk/bin/ebuild 2008-07-29 17:50:36 UTC (rev 11267) |
16 |
+++ main/trunk/bin/ebuild 2008-07-29 18:31:19 UTC (rev 11268) |
17 |
@@ -3,9 +3,24 @@ |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
# $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $ |
20 |
|
21 |
+import sys |
22 |
+# This block ensures that ^C interrupts are handled quietly. |
23 |
+try: |
24 |
+ import signal |
25 |
+ |
26 |
+ def exithandler(signum,frame): |
27 |
+ signal.signal(signal.SIGINT, signal.SIG_IGN) |
28 |
+ signal.signal(signal.SIGTERM, signal.SIG_IGN) |
29 |
+ sys.exit(1) |
30 |
+ |
31 |
+ signal.signal(signal.SIGINT, exithandler) |
32 |
+ signal.signal(signal.SIGTERM, exithandler) |
33 |
+ |
34 |
+except KeyboardInterrupt: |
35 |
+ sys.exit(1) |
36 |
+ |
37 |
import optparse |
38 |
import os |
39 |
-import sys |
40 |
|
41 |
description = "See the ebuild(1) man page for more info" |
42 |
usage = "Usage: ebuild <ebuild file> <command> [command] ..." |