Fix bug in ttyio that causes premature exit on pipe/file input.
authorChris Hanson <org/chris-hanson/cph>
Sat, 4 Feb 2017 21:39:29 +0000 (13:39 -0800)
committerChris Hanson <org/chris-hanson/cph>
Sat, 4 Feb 2017 21:39:29 +0000 (13:39 -0800)
src/runtime/ttyio.scm

index bbc8f299e09cc57ee8c0c2f1062defc9908f9655..9a6356fb524c09e1456944ee5f91da2d64ef56c9 100644 (file)
@@ -120,11 +120,12 @@ USA.
 (define (operation/read-finish port)
   (let loop ()
     (if (char-ready? port)
-       (let ((char (read-char port)))
+       (let ((char (generic-io/peek-char port)))
          (if (not (eof-object? char))
              (if (char-whitespace? char)
-                 (loop)
-                 (unread-char char port))))))
+                 (begin
+                   (generic-io/read-char port)
+                   (loop)))))))
   (output-port/discretionary-flush port))
 
 (define (operation/discretionary-write-char char port)