Fix bug: reading output from a subprocess would occasionally signal an
authorChris Hanson <org/chris-hanson/cph>
Mon, 13 May 1996 05:01:11 +0000 (05:01 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 13 May 1996 05:01:11 +0000 (05:01 +0000)
error because the subprocess output channel was closed by Scheme when
it detected that the subprocess had closed the other end of the pipe.
However, the "output-copier" loop continued to operate assuming that
the channel was open.

v7/src/edwin/process.scm

index 844dc660af22944f378e97b1eb051a9aab4a94ec..c769f0517006dd0220f3166694a5b5ce2780715e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: process.scm,v 1.43 1996/05/12 07:13:03 cph Exp $
+;;;    $Id: process.scm,v 1.44 1996/05/13 05:01:11 cph Exp $
 ;;;
 ;;;    Copyright (c) 1991-96 Massachusetts Institute of Technology
 ;;;
@@ -689,9 +689,11 @@ after the listing is made.)"
                               (loop))))))))))
          (channel-nonblocking channel)
          (let ((status (receiver copy-output)))
-           (channel-blocking channel)
-           (copy-output)
-           (channel-close channel)
+           (if (channel-open? channel)
+               (begin
+                 (channel-blocking channel)
+                 (copy-output)
+                 (channel-close channel)))
            status)))
       (receiver (lambda () unspecific))))
 \f