ignore signals that don't exist
This commit is contained in:
parent
b87e52347b
commit
e3b06d29ab
|
@ -71,10 +71,13 @@ class Application(web.Application):
|
||||||
|
|
||||||
|
|
||||||
def set_signal_handler(self):
|
def set_signal_handler(self):
|
||||||
signal.signal(signal.SIGHUP, self.stop)
|
for sig in {'SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM'}:
|
||||||
signal.signal(signal.SIGINT, self.stop)
|
try:
|
||||||
signal.signal(signal.SIGQUIT, self.stop)
|
signal.signal(getattr(signal, sig), self.stop)
|
||||||
signal.signal(signal.SIGTERM, self.stop)
|
|
||||||
|
# some signals don't exist in windows, so skip them
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Reference in a new issue