From 15fa879cbaa8d270e01cadad91c9fcaf5079f711 Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 19 Jul 2026 15:30:25 +0000 Subject: [PATCH] fix: bypass cli_progress wrapper when stdout is not a TTY apply_configs / apply_users invoked over non-interactive SSH or from background jobs hang forever in cli_progress urwid, leaving sing-box configs stale after Admin API user renewals. When stdout is not a terminal, run the wrapped install/apply command directly. Fixes #5479 Related: #5505 Co-authored-by: Cursor --- common/utils.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/common/utils.sh b/common/utils.sh index 596a8973d..71be7b3b1 100644 --- a/common/utils.sh +++ b/common/utils.sh @@ -442,6 +442,33 @@ function save_firewall() { function show_progress_window() { disable_ansii_modes activate_python_venv + # Non-interactive runs (SSH without PTY, cron, background apply) hang forever in + # cli_progress urwid when wrapped this way. Run the target command directly. + # See https://github.com/hiddify/Hiddify-Manager/issues/5479 + if [[ ! -t 1 ]]; then + local -a run_cmd=() + local skip=0 + for arg in "$@"; do + if [[ $skip -eq 1 ]]; then + skip=0 + continue + fi + case "$arg" in + --log|--title|--subtitle|--regex) + skip=1 + ;; + --) + ;; + *) + run_cmd+=("$arg") + ;; + esac + done + bash "${run_cmd[@]}" + exit_code=$? + disable_ansii_modes + return $exit_code + fi install_pypi_package cli-progress python -m cli_progress --title "Hiddify Manager" "$@" exit_code=$?