diff --git a/install-wings.sh b/install-wings.sh index 7e4c922..9828f1d 100644 --- a/install-wings.sh +++ b/install-wings.sh @@ -34,9 +34,19 @@ need_tty() { prompt() { local msg="$1" - local out + local out line printf "${BOLD}%s${RESET}" "$msg" >"$TTY" IFS= read -r out <"$TTY" + + # A pasted value (e.g. join-data copied from the panel UI) can arrive with an + # embedded newline. `read` stops at the first one, which would otherwise + # silently truncate the rest onto a "phantom" line consumed by a later + # prompt. Drain any additional lines that are already buffered so nothing + # gets lost; this never blocks waiting on new keystrokes. + while IFS= read -r -t 0.1 line <"$TTY" 2>/dev/null; do + out+="$line" + done + printf "%s" "$out" }