Source

CherryPy / cherrypy / _cpengine.py

The branch 'cherrypy-3.0.x' does not exist.
Diff from to

cherrypy/_cpengine.py

             self.stop()
     
     def _set_signals(self):
-        if self.SIGHUP:
-            signal.signal(signal.SIGHUP, self.SIGHUP)
-        if self.SIGTERM:
-            signal.signal(signal.SIGTERM, self.SIGTERM)
-    
+        try:
+            if self.SIGHUP:
+                signal.signal(signal.SIGHUP, self.SIGHUP)
+            if self.SIGTERM:
+                signal.signal(signal.SIGTERM, self.SIGTERM)
+        except ValueError, x:
+            if x.args[0] != 'signal only works in main thread':
+                raise
     
     #                           Drop privileges                           #