fix(core): handle sigint before app startup (#2189)

This commit is contained in:
huanghuoguoguo
2026-05-16 11:24:34 +08:00
committed by GitHub
parent 9e8c8f79df
commit 6fe20c1812
2 changed files with 67 additions and 1 deletions

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)