From c2270a0f8fddedfd6d42f48242738871250948d9 Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 19 Jul 2026 15:30:25 +0000 Subject: [PATCH] fix: bypass urwid UI when stdout is not a TTY Without a terminal, cli_progress wraps install/apply in an urwid MainLoop that never exits after the subprocess finishes. This leaves apply_configs and apply_users stuck indefinitely and prevents sing-box configs from reloading. Run the wrapped command directly in non-interactive environments. Fixes hiddify/Hiddify-Manager#5479 Co-authored-by: Cursor --- cli_progress/__main__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cli_progress/__main__.py b/cli_progress/__main__.py index 6ec2256..cf83c44 100644 --- a/cli_progress/__main__.py +++ b/cli_progress/__main__.py @@ -2,6 +2,8 @@ import argparse +import subprocess +import sys from .progress_ui import ProgressUI @@ -33,6 +35,17 @@ def parse_arguments(): def main(): args = parse_arguments() + # Without a TTY, urwid's MainLoop never exits after the subprocess finishes + # (see hiddify/Hiddify-Manager#5479). Run the wrapped command directly. + if not sys.stdout.isatty(): + cmd = args.command + if cmd and cmd[0] == "--": + cmd = cmd[1:] + if not cmd: + print("cli_progress: no command provided", file=sys.stderr) + raise SystemExit(2) + raise SystemExit(subprocess.call(cmd)) + ui = ProgressUI(args.log, args.command, args.title, args.subtitle, args.regex) ui.start()