template.sh:35 picks the ANSI fallback by the presence of tput, not by the call succeeding:
if command -v tput >/dev/null 2>&1; then tput clear; else printf '\033[2J\033[3J\033[H'; fi
tput is almost always installed, but it fails when TERM has no terminfo entry for clearing the screen:
$ TERM=dumb tput clear; echo $?
1
Under the template's own set -euo pipefail that exit code kills the wizard inside banner, before the first line of output. The user sees an empty screen and exit code 1, with no reason and no first question. Seen on TERM=dumb and inside a CI pty; a wizard generated from this template is unusable on such a terminal.
Fix: branch on the call, not on the binary.
- if command -v tput >/dev/null 2>&1; then tput clear; else printf '\033[2J\033[3J\033[H'; fi
+ if command -v tput >/dev/null 2>&1 && tput clear 2>/dev/null; then return 0; fi
+ printf '\033[2J\033[3J\033[H'
A failure inside an if condition does not trip errexit, so this is safe under set -e in bash 3.2 as well; 2>/dev/null keeps terminfo complaints from preceding the banner.
Reproduce on a pty, not a pipe: _clear returns 0 early when stdout is not a tty, so the defect does not exist under a pipe.
template.sh:35picks the ANSI fallback by the presence oftput, not by the call succeeding:tputis almost always installed, but it fails whenTERMhas no terminfo entry for clearing the screen:Under the template's own
set -euo pipefailthat exit code kills the wizard insidebanner, before the first line of output. The user sees an empty screen and exit code 1, with no reason and no first question. Seen onTERM=dumband inside a CI pty; a wizard generated from this template is unusable on such a terminal.Fix: branch on the call, not on the binary.
A failure inside an
ifcondition does not triperrexit, so this is safe underset -ein bash 3.2 as well;2>/dev/nullkeeps terminfo complaints from preceding the banner.Reproduce on a pty, not a pipe:
_clearreturns 0 early when stdout is not a tty, so the defect does not exist under a pipe.