move logging to method in ErrorHandler

This commit is contained in:
Raphael Deem
2017-02-13 18:07:35 -08:00
parent 75fca1b9c7
commit de6c646ee8
2 changed files with 14 additions and 3 deletions

View File

@@ -346,7 +346,11 @@ def serve(host, port, request_handler, error_handler, before_start=None,
# Register signals for graceful termination
if register_sys_signals:
for _signal in (SIGINT, SIGTERM):
loop.add_signal_handler(_signal, loop.stop)
try:
loop.add_signal_handler(_signal, loop.stop)
except NotImplementedError:
log.warn(('Sanic tried to use loop.add_signal_handler')
('but it is not implemented on this platform.'))
pid = os.getpid()
try: