fix: reopen stdin from terminal when script is piped

This commit is contained in:
Linus Rath
2026-03-13 00:48:19 +01:00
parent 21e6fd9078
commit 46a80f3773
+6 -6
View File
@@ -970,11 +970,6 @@ trap cleanup INT TERM
# ── 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
get_term_size
if [[ $TERM_COLS -lt 60 || $TERM_ROWS -lt 20 ]]; then
@@ -1030,4 +1025,9 @@ load_existing_config() {
get_env_val "LOGIN_WEBSITE_URL"; [[ -n "$val" ]] && CFG_LOGIN_WEBSITE_URL="$val"
}
main "$@"
# When piped (e.g. curl | bash), reopen stdin from the terminal
if [[ -t 0 ]]; then
main "$@"
else
main "$@" < /dev/tty
fi