use try/except when adding loop sig handlers
This commit is contained in:
parent
75fca1b9c7
commit
41c6125e1b
|
@ -346,7 +346,11 @@ def serve(host, port, request_handler, error_handler, before_start=None,
|
||||||
# Register signals for graceful termination
|
# Register signals for graceful termination
|
||||||
if register_sys_signals:
|
if register_sys_signals:
|
||||||
for _signal in (SIGINT, SIGTERM):
|
for _signal in (SIGINT, SIGTERM):
|
||||||
|
try:
|
||||||
loop.add_signal_handler(_signal, loop.stop)
|
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()
|
pid = os.getpid()
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user