From: Chris Hanson Date: Tue, 23 Nov 1993 01:23:16 +0000 (+0000) Subject: BSD PTYs signal I/O-error when trying to read from a master side whose X-Git-Tag: 20090517-FFI~7437 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3046562891be05f269d040e47f45d7a8c2a24c90;p=mit-scheme.git BSD PTYs signal I/O-error when trying to read from a master side whose slave has been closed; SYSV PTYs return EOF in same case. Add code to handle BSD case (this code has a race in it but seems to work OK). --- diff --git a/v7/src/edwin/process.scm b/v7/src/edwin/process.scm index 528c452e6..98a2ab9e2 100644 --- a/v7/src/edwin/process.scm +++ b/v7/src/edwin/process.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: process.scm,v 1.31 1993/09/10 19:12:52 cph Exp $ +;;; $Id: process.scm,v 1.32 1993/11/23 01:23:16 cph Exp $ ;;; ;;; Copyright (c) 1991-93 Massachusetts Institute of Technology ;;; @@ -277,16 +277,18 @@ Initialized from the SHELL environment variable." (let ((channel (process-input-channel process)) (buffer (make-string 512))) (and (channel-open? channel) - (let ((n (channel-read channel buffer 0 512))) - (cond ((not n) - #f) - ((> n 0) - (output-substring process buffer n)) - (else + (let ((close-input + (lambda () (deregister-process-input process) (channel-close channel) (%update-global-notification-tick) - (poll-process-for-status-change process))))))) + (poll-process-for-status-change process)))) + (if (process-runnable? process) + (let ((n (channel-read channel buffer 0 512))) + (cond ((not n) #f) + ((> n 0) (output-substring process buffer n)) + (else (close-input)))) + (close-input)))))) (define (process-send-eof process) (process-send-char process #\EOT))