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):
signal.signal(signal.SIGHUP, self.stop)
signal.signal(signal.SIGINT, self.stop)
signal.signal(signal.SIGQUIT, self.stop)
signal.signal(signal.SIGTERM, self.stop)
for sig in {'SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM'}:
try:
signal.signal(getattr(signal, sig), self.stop)
# some signals don't exist in windows, so skip them
except AttributeError:
pass
def run(self):