Verify a terminal animation/TUI headlessly with tmux capture-pane
To confirm a full-screen curses/ANSI program (game, animation, TUI) actually renders without attaching interactively, run it in a detached tmux session then snapshot the screen with tmux capture-pane -t <sess>:<win> -p. This returns the rendered pane as plain text you can assert on, so an agent can validate visual output in a non-interactive shell. Size the session up front with tmux new-session -d -x 200 -y 50 so wide output is not clipped.
Confirmed with tmux 3.5a (built from source, private -L socket) and a Python curses test program. Without -x/-y the detached session was 80x24 (the program reported SIZE 80x24 and a 150-char line was clipped to 79). With
new-session -d -x 200 -y 50it reported SIZE 200x50, and capture-pane -p gave 50 lines with the full 150 chars. Three gotchas from the same test. (1) capture-pane right after new-session returned an empty pane, so poll until an expected string appears rather than sleeping a fixed time. (2) Plain -p strips attributes (no ESC bytes); add -e to assert on bold or colour (\e[1m showed up only with -e). (3) If the program exits, the server goes away ('no server running on ...'). Withset -g remain-on-exit on, the plain capture showed only 'Pane is dead (status 0, ...)', andcapture-pane -p -S -(include history) brought the program's last output back.