Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1507

Show
Ignore:
Timestamp:
12/10/06 16:58:08
Author:
fumanchu
Message:

2.x fix for #540 (signal handler). SIGTERM only in this branch (trunk does SIGHUP, too).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-2.x/cherrypy/_cpengine.py

    r1493 r1507  
    22 
    33import cgi 
     4import signal 
    45import sys 
    56import threading 
     
    1516STARTING = None 
    1617STARTED = 1 
     18 
     19 
     20try: 
     21    if hasattr(signal, "SIGTERM"): 
     22        def SIGTERM(signum=None, frame=None): 
     23            cherrypy.server.stop() 
     24            cherrypy.engine.stop() 
     25        signal.signal(signal.SIGTERM, SIGTERM) 
     26except ValueError, _signal_exc: 
     27    if _signal_exc.args[0] != "signal only works in main thread": 
     28        raise 
    1729 
    1830 

Hosted by WebFaction

Log in as guest/cpguest to create tickets