From 1d2469f0ae76b30f6652308465ba85ea86a40cc7 Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Mon, 23 Mar 2026 03:00:26 +0800 Subject: [PATCH] fix: use sys.stdin.isatty() for non-interactive detection Replace redundant ASTRBOT_SYSTEMD environment variable checks with sys.stdin.isatty() for detecting non-interactive environments. The DashboardManager.ensure_installed() already handles this internally, so the outer ASTRBOT_SYSTEMD checks were unnecessary. --- astrbot/cli/commands/cmd_init.py | 6 +----- astrbot/cli/commands/cmd_run.py | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/astrbot/cli/commands/cmd_init.py b/astrbot/cli/commands/cmd_init.py index 912e322bd..662b26e67 100644 --- a/astrbot/cli/commands/cmd_init.py +++ b/astrbot/cli/commands/cmd_init.py @@ -138,11 +138,7 @@ async def initialize_astrbot( default=True, ) ): - # 避免在 systemd 模式下因等待输入而阻塞 - if os.environ.get("ASTRBOT_SYSTEMD") == "1": - click.echo("Systemd detected: Skipping dashboard check.") - else: - await DashboardManager().ensure_installed(astrbot_root) + await DashboardManager().ensure_installed(astrbot_root) else: click.echo("你可以使用在线面版(需支持配置后端)来控制。") diff --git a/astrbot/cli/commands/cmd_run.py b/astrbot/cli/commands/cmd_run.py index ea9a74e85..69a3aed62 100644 --- a/astrbot/cli/commands/cmd_run.py +++ b/astrbot/cli/commands/cmd_run.py @@ -93,9 +93,7 @@ async def run_astrbot(astrbot_root: Path) -> None: os.environ.get("ASTRBOT_DASHBOARD_ENABLE", os.environ.get("DASHBOARD_ENABLE")) == "True" ): - # Avoid blocking when running under systemd by waiting for input - if os.environ.get("ASTRBOT_SYSTEMD") != "1": - await DashboardManager().ensure_installed(astrbot_root) + await DashboardManager().ensure_installed(astrbot_root) log_broker = LogBroker() LogManager.set_queue_handler(logger, log_broker)