diff options
author | Andy Wingo <wingo@pobox.com> | 2009-02-24 23:16:58 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-02-24 23:16:58 +0100 |
commit | abf780e45e814def03ea3bb1810b0ed1a236142a (patch) | |
tree | 6bdc1c11fd86b78329c46757ba8325a368b75f96 /module | |
parent | a56db0f67edb093cc3611dede2c49d1fb4a88a5e (diff) | |
download | guile-abf780e45e814def03ea3bb1810b0ed1a236142a.tar.gz |
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.
Diffstat (limited to 'module')
-rw-r--r-- | module/system/repl/repl.scm | 12 |
1 files 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 |