Move initial signal handlers to the launcher script.
authorZac Medico <zmedico@gentoo.org>
Tue, 23 Dec 2008 22:43:28 +0000 (22:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 23 Dec 2008 22:43:28 +0000 (22:43 -0000)
svn path=/main/trunk/; revision=12290

bin/emerge
pym/_emerge/__init__.py

index 1ef575e1304be6243f4530b53a13759dc5fc48db..40e3b19f03f940e64f11037862f7db91c7aca47e 100755 (executable)
@@ -3,6 +3,23 @@
 # Portage Emerge bits
 # $Id$
 
+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)
+       signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+except KeyboardInterrupt:
+       sys.exit(1)
+
 try:
        import _emerge
 except ImportError:
index acca12acee8ab967692a89f0dd51317e3cad6b01..31e669aae5bf59af2c7826a234ca311be32f3dfa 100644 (file)
@@ -3,23 +3,6 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id: emerge 5976 2007-02-17 09:14:53Z genone $
 
-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)
-       signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-except KeyboardInterrupt:
-       sys.exit(1)
-
 import array
 from collections import deque
 import fcntl
@@ -28,6 +11,8 @@ import logging
 import select
 import shlex
 import shutil
+import signal
+import sys
 import textwrap
 import urlparse
 import weakref