From abf780e45e814def03ea3bb1810b0ed1a236142a Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 24 Feb 2009 23:16:58 +0100 Subject: [PATCH] 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. --- module/system/repl/repl.scm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm index 93f20c5ab..b6fab99da 100644 --- a/module/system/repl/repl.scm +++ b/module/system/repl/repl.scm @@ -38,9 +38,15 @@ (with-input-from-port (if (pair? read-args) (car read-args) (current-input-port)) (lambda () - (if (eqv? (next-char #t) #\,) - (begin (read-char) meta-command-token) - (read)))))) + (let ((ch (next-char #t))) + (cond ((eof-object? ch) + ;; 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 ;; something else if readline has been activated. much of this hoopla is