ignore signals that don't exist

This commit is contained in:
Izalia Mae 2022-11-16 13:26:47 -05:00
parent b87e52347b
commit e3b06d29ab

View file

@ -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):