edwin/process.scm (poll-process-for-output): allow for reading #f
authorMatt Birkholz <puck@birchwood-abbey.net>
Fri, 5 Aug 2016 21:42:13 +0000 (14:42 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Sun, 7 Aug 2016 17:57:03 +0000 (10:57 -0700)
src/edwin/process.scm

index 4f5bbf6336f6018a5a51af6192f6edb1c57fe2b5..e19a40f6ba4821c09eff010fdce533146f272745 100644 (file)
@@ -249,13 +249,14 @@ Initialized from the SHELL environment variable."
                (call-with-current-continuation
                 (lambda (k)
                   (bind-condition-handler (list condition-type:port-error)
-                      (lambda (condition) condition (k #t))
+                      (lambda (condition) condition (k 'ERROR))
                     (lambda ()
                       (input-port/read-string! port input-buffer)))))))
-          (if (or (not (fixnum? n))
-                  (fix:= n 0))
+          (if (or (eq? 'ERROR n)
+                  (and (fixnum? n) (fix:= n 0)))
               (close-port port)
-              (output-substring process input-buffer n))
+              (if (and (fixnum? n) (fix:> n 0))
+                  (output-substring process input-buffer n)))
           (and (fixnum? n)
                (fix:> n 0))))))
 \f