fix(logging): restore AUR progress bars and render clean colored logs #44
Reference in New Issue
Block a user
Delete Branch "fix/aur-wrapper-pty-progress-bars"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
With logging enabled, paru/yay showed no download progress bars. The wrappers piped output through
tee, so libalpm detected a non-TTY stdout and suppressed the bars. This PR restores on-screen progress bars and produces clean, colored log files.The fix, in two parts
1. PTY capture restores on-screen progress bars
The wrappers now run paru/yay inside a pseudo-TTY via
script(1)(-q -e -c), so libalpm sees a real terminal and renders progress bars normally on screen.2. Terminal emulator renders clean static logs
pacman's download progress is a multi-line terminal animation — it repaints lines in place using ANSI cursor-movement (
ESC[<n>A) and erase-line (ESC[K) sequences, not just carriage returns. No line-wise regex can reconstruct that: stripping CRs concatenates every redraw frame into one giant line, while collapsing on CRs discards the final frame and leaves blanks.New helper
scripts/clean_progress_log.pyis a small, dependency-free terminal screen-buffer emulator. It replays the captured cursor movements against an in-memory grid exactly as a real terminal would, then dumps the final static frame. SGR color codes are preserved (so logs still render with color inov/bat/less -R), and thescript(1)header/footer are dropped. Ifpython3is unavailable, the wrapper falls back to stripping only thescript(1)header.Both wrappers are bumped to version 5 to force regeneration; old wrappers are removed automatically.
Files
conf.d/paru-wrapper.fish,conf.d/yay-wrapper.fish— PTY capture + pipe through the cleaner (version 5)scripts/clean_progress_log.py— terminal-emulator log renderer (new)docs/fish-config.md— document thescripts/dir and the capture/render mechanismManual Verification
source ~/.config/fish/conf.d/paru-wrapper.fish) and confirm~/.local/bin/paruis version 5paru -Syu(orparu -Sw <uncached-pkg>) and confirm download progress bars are visible on screen~/.terminal_history/paru_*.log(e.g.logs -c paru) and confirm it shows the final progress frame only — no concatenated frames, no blank gaps, noScript started/doneheaderset -U __fish_config_op_logging 0), confirm the wrapper is removed from~/.local/bin/; re-enable (set -e __fish_config_op_logging) and confirm it regenerates at version 5python3out of PATH (or test on a host without it) and confirm the wrapper still produces a usable log via the fallbackyayif installedcol -bp is designed for backspace-overstriking (man pages), not ANSI terminal animations; it mangled escape sequences and garbled overprinted progress bar text. Replace with a perl -ne one-liner that: 1. Skips Script started/done header lines (next if matches, with -ne so next truly suppresses print, unlike -pe which still auto-prints) 2. Strips trailing \r from PTY \r\n line endings 3. Collapses CR-redrawn progress bar frames to their final state 4. Preserves all ANSI color codes so ov renders them correctly Bump wrapper version to 4 to force regeneration.fix(logging): run paru/yay wrappers in PTY to restore progress barsto fix(logging): restore AUR progress bars and render clean colored logs