Skip to content
Snippets Groups Projects
Commit 6c87897e authored by wlott's avatar wlott
Browse files

Fixed COPY-DESCRIPTOR-TO-STREAM to no longer try to read directly into a

string, but instead stage through the a stack alien.  This way, we can
handle GCing if the read is interrupted.
parent 62822c7a
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/run-program.lisp,v 1.9 1992/02/15 12:50:37 wlott Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/run-program.lisp,v 1.10 1992/02/17 03:11:36 wlott Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -536,28 +536,31 @@ ...@@ -536,28 +536,31 @@
(unix:get-unix-error-msg readable/errno))) (unix:get-unix-error-msg readable/errno)))
((zerop result) ((zerop result)
(return)))) (return))))
(multiple-value-bind (alien:with-alien ((buf (alien:array c-call:char 256)))
(count errno) (multiple-value-bind
(unix:unix-read descriptor (count errno)
string (unix:unix-read descriptor (alien-sap buf) 256)
(length string)) (cond ((or (and (null count)
(cond ((or (and (null count) (eql errno unix:eio))
(eql errno unix:eio)) (eql count 0))
(eql count 0)) (system:remove-fd-handler handler)
(system:remove-fd-handler handler) (setf handler nil)
(setf handler nil) (decf (car cookie))
(decf (car cookie)) (unix:unix-close descriptor)
(unix:unix-close descriptor) (return))
(return)) ((null count)
((null count) (system:remove-fd-handler handler)
(system:remove-fd-handler handler) (setf handler nil)
(setf handler nil) (decf (car cookie))
(decf (car cookie)) (error "Could not read input from sub-process: ~A"
(error "Could not read input from sub-process: ~A" (unix:get-unix-error-msg errno)))
(unix:get-unix-error-msg errno))) (t
(t (kernel:copy-from-system-area
(write-string string stream (alien-sap buf) 0
:end count)))))))))) string (* vm:vector-data-offset vm:word-bits)
(* count vm:byte-bits))
(write-string string stream
:end count)))))))))))
;;; GET-DESCRIPTOR-FOR -- internal ;;; GET-DESCRIPTOR-FOR -- internal
;;; ;;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment