From 03c0b4c73e994c08c3c1cd876f4032dd19ea634c Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Mon, 23 Mar 2026 00:55:56 +0800 Subject: [PATCH] fix: skip interactive dashboard prompt in systemd mode When running under systemd (ASTRBOT_SYSTEMD=1), the click.confirm() prompt would raise Abort on user input, crashing the service. Skip the interactive confirmation and silently return instead. --- astrbot/cli/utils/dashboard.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/astrbot/cli/utils/dashboard.py b/astrbot/cli/utils/dashboard.py index d0cced998..bd88fe7eb 100644 --- a/astrbot/cli/utils/dashboard.py +++ b/astrbot/cli/utils/dashboard.py @@ -23,10 +23,13 @@ class DashboardManager: match dashboard_version: case None: click.echo("Dashboard is not installed") + # Skip interactive prompt when running under systemd + if os.environ.get("ASTRBOT_SYSTEMD") == "1": + click.echo("Skipping interactive dashboard installation in systemd mode.") + return if click.confirm( "Install dashboard?", default=True, - abort=True, ): click.echo("Installing dashboard...") try: @@ -39,6 +42,8 @@ class DashboardManager: click.echo("Dashboard installed successfully") except Exception as e: click.echo(f"Failed to install dashboard: {e}") + else: + click.echo("Dashboard installation declined.") case str(): if (