diff options
Diffstat (limited to 'scsh-process.scm')
-rw-r--r-- | scsh-process.scm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/scsh-process.scm b/scsh-process.scm index a5d3df6..e2be39c 100644 --- a/scsh-process.scm +++ b/scsh-process.scm @@ -312,17 +312,22 @@ (with-output-to-port (open-output-file* 1) thunk))))) temp-file)) +(define (call-with-run/port* thunk consumer) + (let ((in (run/port* thunk))) + ;; This is really more like unwind-protect + (dynamic-wind + void + (lambda () (consumer in)) + (lambda () (close-input-port in))))) + (define (run/string* thunk) - (read-string #f (run/port* thunk))) + (call-with-run/port* thunk (lambda (in) (read-string #f in)))) (define (run/strings* thunk) - (read-lines (run/port* thunk))) + (call-with-run/port* thunk read-lines)) (define (run/sexp* thunk) - (let* ((p (run/port* thunk)) - (res (read p))) - (close-input-port p) - res)) + (call-with-run/port* thunk read)) (define (run/sexps* thunk) - (read-file (run/port* thunk))) + (call-with-run/port* thunk read-file)) ;;;;;;;;;;;; ;; Syntax ;; |