1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-22 04:30:19 +02:00

in meta-reader, return directly if the peeked char is EOF

* module/system/repl/repl.scm (meta-reader): If the (next-char #t)
  returns EOF, return that EOF directly, as it seems that with guile -q,
  the subsequent `read' actually waits for another C-d. Dunno why.
This commit is contained in:
Andy Wingo 2009-02-24 23:16:58 +01:00
parent a56db0f67e
commit abf780e45e

View file

@ -38,9 +38,15 @@
(with-input-from-port (with-input-from-port
(if (pair? read-args) (car read-args) (current-input-port)) (if (pair? read-args) (car read-args) (current-input-port))
(lambda () (lambda ()
(if (eqv? (next-char #t) #\,) (let ((ch (next-char #t)))
(begin (read-char) meta-command-token) (cond ((eof-object? ch)
(read)))))) ;; apparently sometimes even if this is eof, read will
;; wait on somethingorother. strange.
ch)
((eqv? (char #\,))
(read-char)
meta-command-token)
(else (read))))))))
;; repl-reader is a function defined in boot-9.scm, and is replaced by ;; repl-reader is a function defined in boot-9.scm, and is replaced by
;; something else if readline has been activated. much of this hoopla is ;; something else if readline has been activated. much of this hoopla is