test fix for terminal UI

This commit is contained in:
Luis Guzmán 2026-01-05 04:18:35 -06:00
parent be870e1a9d
commit c7d0620f7a
1 changed files with 10 additions and 1 deletions

View File

@ -44,6 +44,9 @@ setup_logging() {
return 0 return 0
fi fi
# Save original console fds so interactive tools still work after we redirect stdout/stderr.
exec 3>&1 4>&2
mkdir -p "$LOG_DIR" 2>/dev/null || true mkdir -p "$LOG_DIR" 2>/dev/null || true
if [[ -z "${LOG_FILE:-}" ]]; then if [[ -z "${LOG_FILE:-}" ]]; then
@ -212,7 +215,13 @@ step_termux_repo_select_once() {
fi fi
ans="${ans:-Y}" ans="${ans:-Y}"
if [[ "$ans" =~ ^[Yy]$ ]]; then if [[ "$ans" =~ ^[Yy]$ ]]; then
termux-change-repo || true # Logging redirects stdout/stderr to pipes, which can break the UI.
# Run it using /dev/tty and the original console fds (3/4).
if [[ -r /dev/tty ]]; then
termux-change-repo </dev/tty >&3 2>&4 || true
else
termux-change-repo || true
fi
ok "Mirror selection completed (or skipped inside the UI)." ok "Mirror selection completed (or skipped inside the UI)."
else else
warn "Mirror selection skipped by user." warn "Mirror selection skipped by user."