diff --git a/scheme/rts-packages.scm b/scheme/rts-packages.scm index c0ebcc0..1305446 100644 --- a/scheme/rts-packages.scm +++ b/scheme/rts-packages.scm @@ -84,7 +84,7 @@ interrupts ; {en|dis}able-interrupts! number-i/o ; number->string for debugging exceptions ; wrong-number-of-args stuff - handle) ; report-errors-as-warnings + handle) ; report-errors-as-warnings with-handler (files (rts port) (rts current-port)) (optimize auto-integrate)) diff --git a/scheme/rts/port.scm b/scheme/rts/port.scm index 9d581a7..e334541 100644 --- a/scheme/rts/port.scm +++ b/scheme/rts/port.scm @@ -206,7 +206,14 @@ (begin (obtain-port-lock ?port) ; lock the port (if (open-port? ?port) ; check that it's open - (let ((value ?body)) ; do the work + (let ((value ; do the work + (with-handler + (lambda (condition punt) + + (release-port-lock ?port) + (punt)) + (lambda () + ?body)))) (release-port-lock ?port) ; release the lock value) ; return (begin