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()