automated_script: restore proven gum stream/env contract
Restore the env + redirect setup that the previously-working ISO
installer used (matching /home/ryan/Downloads/ISO scripts/.automated_script.sh):
export COLUMNS=$(tput cols)
export LINES=$(tput lines)
exec > >(tee >(sed CSI-strip >> log) 2>/dev/null) 2>/dev/tty
export CLICOLOR_FORCE=1
export FORCE_COLOR=1
The cutover commit (064b5e2) silently dropped these. Subsequent
attempts to fix the TTY/gum rendering by reshaping the redirect were
all symptom-chasing — the proven shape was correct. The key insight:
- gum draws its TUI on stderr, not stdout. 2>/dev/tty keeps that
rendering on the real terminal.
- stdout-as-pipe (via tee) is *desired*: it lets gum detect a
non-TTY stdout and skip cursor-position probes (CSI 6n). Without
that detection, the DSR replies leak as visible ^[[13;1R bytes.
- CLICOLOR_FORCE/FORCE_COLOR force gum to still emit colour despite
stdout being a pipe.
Also drops the configurator's _drain_tty workaround — unnecessary
once gum stops sending DSR queries in the first place.
This commit is contained in:
2 files changed
+13
-32
No files matched your search
@@ -13,21 +13,10 @@ abort() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Drain any pending terminal-reply bytes (cursor position reports, etc.)
|
||||
# that gum's TUI startup sends but doesn't always consume. Without this,
|
||||
# bytes like ^[[13;1R show up next to step titles.
|
||||
_drain_tty() {
|
||||
# Consume up to 9999 bytes of pending tty input with a short timeout.
|
||||
# `read -t 0` only TESTS for input; it doesn't consume — that pattern
|
||||
# hangs forever the moment any data is actually pending.
|
||||
read -r -t 0.05 -N 9999 _drain </dev/tty 2>/dev/null || true
|
||||
}
|
||||
|
||||
step() {
|
||||
clear_logo
|
||||
echo
|
||||
gum style "$1"
|
||||
_drain_tty
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user