-
-
Notifications
You must be signed in to change notification settings - Fork 413
Open
Description
This:
def serve_forever(self):
# we could join on the threads, but join blocks all interrupts (including
# ctrl+c, so just spin here
# noinspection PyBroadException
try:
def sig_manager(sig, callstack):
self.stop()
self._log.info('*** signal %d received.' % sig)
return signal.SIG_IGN
prev_handler = signal.signal(signal.SIGINT, sig_manager)
except Exception:
# signal.pause() is missing for Windows; wait 1ms and loop instead
pass
except KeyboardInterrupt:
pass
in remi/server.py is just... WTF? How am I supposed to end the app gracefully with interrupt signal if Remi is just another user interface (it has physical buttons)?
The remi package (__init__.py) even imports a special function for starting the server:
from .server import App, Server, start
But apparently there is absolutely no interface for stopping it. Why?
I've found this old bug report where a functional solution was proposed but the report was closed for no reason: #274 (comment)
So, if one has an instance of such a MyApp, they can do this:
my_app = MyApp()
def interrupt_handler():
my_app_instance.server.server_starter_instance._alive = False
my_app_instance.server.server_starter_instance._sserver.shutdown()
return signal.SIG_DFL
remi.start(my_app, ...)
signal.signal(signal.SIGINT, interrupt_handler)
or they have to implement such a handler into their MyApp.
Metadata
Metadata
Assignees
Labels
No labels