diff --git a/racket/collects/pkg/private/print.rkt b/racket/collects/pkg/private/print.rkt index 8bc340d6a3..fc97c5a0d9 100644 --- a/racket/collects/pkg/private/print.rkt +++ b/racket/collects/pkg/private/print.rkt @@ -49,24 +49,30 @@ (if default-yes? "Y" "y") (if default-yes? "n" "N")) (flush-output) - (match (string-trim (read-line (current-input-port) 'any)) - [(or "y" "Y") - 'yes] - [(or "n" "N") - 'no] - [(or "a" "A") - 'always-yes] - [(or "c" "C") + (define reply (read-line (current-input-port) 'any)) + (cond + [(eof-object? reply) + (eprintf "\nTreating end-of-file input as \"cancel\".\n") 'cancel] - ["" - (if default-yes? 'yes 'no)] - [x - (eprintf "Invalid answer: ~a\n" x) - (eprintf " Answer ~a`y' or `Y' for \"yes\", ~a`n' or `N' for \"no\", or\n" - (if default-yes? "nothing or " "") - (if default-yes? "" "nothing or ")) - (eprintf " `a' or `A' for \"yes for all\", or `c' or `C' for \"cancel\".\n") - (loop)]))) + [else + (match (string-trim reply) + [(or "y" "Y") + 'yes] + [(or "n" "N") + 'no] + [(or "a" "A") + 'always-yes] + [(or "c" "C") + 'cancel] + ["" + (if default-yes? 'yes 'no)] + [x + (eprintf "Invalid answer: ~a\n" x) + (eprintf " Answer ~a`y' or `Y' for \"yes\", ~a`n' or `N' for \"no\", or\n" + (if default-yes? "nothing or " "") + (if default-yes? "" "nothing or ")) + (eprintf " `a' or `A' for \"yes for all\", or `c' or `C' for \"cancel\".\n") + (loop)])]))) (define (dry-run-explain dry-run?)