From 7a7fd4167ae020cf2c541613ba0b53e765562b27 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 10 May 2025 12:21:21 -0400 Subject: [PATCH] style: format code --- astrbot/core/updator.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/astrbot/core/updator.py b/astrbot/core/updator.py index 9f108feb..9a5dcc02 100644 --- a/astrbot/core/updator.py +++ b/astrbot/core/updator.py @@ -50,22 +50,19 @@ class AstrBotUpdator(RepoZipUpdator): time.sleep(delay) self.terminate_child_processes() py = sys.executable - + try: - if "astrbot" in os.path.basename(sys.argv[0]): # 兼容cli + if "astrbot" in os.path.basename(sys.argv[0]): # 兼容cli cmd = [py, "-m", "astrbot.cli.__main__"] + sys.argv[1:] else: cmd = [py] + sys.argv - - subprocess.Popen( - cmd, - start_new_session=True - ) - + + subprocess.Popen(cmd, start_new_session=True) + except Exception as e: logger.error(f"重启失败({py} {cmd},错误:{e}),请尝试手动重启。") raise e - + os._exit(0) async def check_update(self, url: str, current_version: str) -> ReleaseInfo: @@ -80,7 +77,7 @@ class AstrBotUpdator(RepoZipUpdator): file_url = None if os.environ.get("ASTRBOT_CLI"): - raise Exception("不支持更新CLI启动的AstrBot") # 避免版本管理混乱 + raise Exception("不支持更新CLI启动的AstrBot") # 避免版本管理混乱 if latest: latest_version = update_data[0]["tag_name"]