fix: 修复ws断开时后端无法正常关闭

This commit is contained in:
DLmaster361
2025-08-27 18:35:50 +08:00
parent af402330b2
commit bce9777eae
3 changed files with 38 additions and 6 deletions

View File

@@ -221,10 +221,10 @@ class _SystemHandler:
["rundll32.exe", "powrprof.dll,SetSuspendState", "0,1,0"]
)
elif mode == "KillSelf":
elif mode == "KillSelf" and Config.server is not None:
logger.info("执行退出主程序操作")
sys.exit(0)
Config.server.should_exit = True
elif sys.platform.startswith("linux"):
@@ -247,10 +247,10 @@ class _SystemHandler:
logger.info("执行睡眠操作")
subprocess.run(["systemctl", "suspend"])
elif mode == "KillSelf":
elif mode == "KillSelf" and Config.server is not None:
logger.info("执行退出主程序操作")
sys.exit(0)
Config.server.should_exit = True
async def kill_emulator_processes(self):
"""这里暂时仅支持 MuMu 模拟器"""