fix(core): handle sigint before app startup

This commit is contained in:
huanghuoguoguo
2026-05-16 10:51:47 +08:00
parent b251fc4b89
commit 937110e193
2 changed files with 67 additions and 1 deletions
+3 -1
View File
@@ -46,12 +46,14 @@ async def make_app(loop: asyncio.AbstractEventLoop) -> app.Application:
async def main(loop: asyncio.AbstractEventLoop):
app_inst: app.Application | None = None
try:
# Hang system signal processing
import signal
def signal_handler(sig, frame):
app_inst.dispose()
if app_inst is not None:
app_inst.dispose()
print('[Signal] Program exit.')
os._exit(0)