feat: reopen stdin from terminal when script is piped

This commit is contained in:
Linus Rath
2026-03-13 00:45:01 +01:00
parent 2a48740ebd
commit 21e6fd9078
+5
View File
@@ -970,6 +970,11 @@ trap cleanup INT TERM
# ── Main ──────────────────────────────────────────────────────────────────── # ── Main ────────────────────────────────────────────────────────────────────
main() { main() {
# When piped (e.g. curl | bash), reopen stdin from the terminal
if [[ ! -t 0 ]]; then
exec < /dev/tty
fi
# Check for minimum terminal size # Check for minimum terminal size
get_term_size get_term_size
if [[ $TERM_COLS -lt 60 || $TERM_ROWS -lt 20 ]]; then if [[ $TERM_COLS -lt 60 || $TERM_ROWS -lt 20 ]]; then