fix file-descriptor leak in process[*]/ports (PR 10229)

svn: r14710

original commit: 83cd3964f4e27c38790762dc44c00b0bf57f6fb2
This commit is contained in:
Matthew Flatt 2009-05-04 12:22:01 +00:00
parent 240fa9dc98
commit 0aea94d804

View File

@ -71,7 +71,11 @@
(define (streamify-out cout out get-thread?)
(if (and cout (not (file-stream-port? cout)))
(let ([t (thread (lambda () (copy-port out cout)))])
(let ([t (thread (lambda ()
(dynamic-wind
void
(lambda () (copy-port out cout))
(lambda () (close-input-port out)))))])
(and get-thread? t))
out))