From 6adeccf1735ea752a58e7147695640f1110a5126 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 11 Jul 2012 21:28:14 +0900 Subject: [PATCH] closing port immediately on return with-{input-from,output-to}-file --- lib/init-7.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/init-7.scm b/lib/init-7.scm index 0b637485..415f1775 100644 --- a/lib/init-7.scm +++ b/lib/init-7.scm @@ -583,7 +583,7 @@ (tmp-in (open-input-file file))) (dynamic-wind (lambda () (current-input-port tmp-in)) - thunk + (lambda () (let ((res (thunk))) (close-input-port tmp-in) res)) (lambda () (current-input-port old-in))))) (define (with-output-to-file file thunk) @@ -591,7 +591,7 @@ (tmp-out (open-output-file file))) (dynamic-wind (lambda () (current-output-port tmp-out)) - thunk + (lambda () (let ((res (thunk))) (close-output-port tmp-out) res)) (lambda () (current-output-port old-out))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;