[Zope-Checkins] CVS: ZODB3/zdaemon - Daemon.py:1.22

Fred L. Drake, Jr. fred at zope.com
Fri Jan 2 16:14:12 EST 2004


Update of /cvs-repository/ZODB3/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv8890

Modified Files:
	Daemon.py 
Log Message:
identify signals by name, not number


=== ZODB3/zdaemon/Daemon.py 1.21 => 1.22 ===
--- ZODB3/zdaemon/Daemon.py:1.21	Fri Nov 28 11:44:58 2003
+++ ZODB3/zdaemon/Daemon.py	Fri Jan  2 16:14:11 2004
@@ -33,6 +33,15 @@
         if signum in [signal.SIGTERM, signal.SIGINT]:
             raise DieNow
 
+PASSED_SIGNALS = (
+    signal.SIGHUP,
+    signal.SIGINT,
+    signal.SIGQUIT,
+    signal.SIGUSR1,
+    signal.SIGUSR2,
+    signal.SIGTERM,
+    )
+
 def run(argv, pidfile=''):
     if os.environ.has_key('ZDAEMON_MANAGED'):
         # We're being run by the child.
@@ -50,9 +59,7 @@
                 # We're the parent (the daemon process)
                 # pass all "normal" signals along to our child, but don't
                 # respond to them ourselves unless they say "die"!
-                interesting = [1, 2, 3, 10, 12, 15]
-                # ie. HUP, INT, QUIT, USR1, USR2, TERM
-                for sig in interesting:
+                for sig in PASSED_SIGNALS:
                     signal.signal(sig, SignalPasser(pid))
                 pstamp('Started subprocess: pid %s' % pid, zLOG.INFO)
                 write_pidfile(pidfile)




More information about the Zope-Checkins mailing list