Changeset 8064 in project


Ignore:
Timestamp:
02/02/08 17:47:33 (12 years ago)
Author:
sjamaan
Message:

Add signal handling to 9p:call-with-output-file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/9p/trunk/9p-client.scm

    r8063 r8064  
    344344                (9p:read-directory h show-dotfiles?)))))))))
    345345
    346 ;; FIRST: FIX PROBLEM WITH UNCLUNKABLE FILE AFTER JUST CREATING IT
    347346;; NEXT UP: 9P:DELETE-FILE, then 9P:RENAME-FILE
    348347
     
    366365    (make-output-port (lambda (s) (9p:file-write h s)) (lambda () (9p:file-close h)))))
    367366
    368 ;; XXX TODO: Make this handle exceptions and always close the port
    369367(define (9p:call-with-output-file con file procedure)
    370   (let* ((p (9p:open-output-file con file))
    371          (result (procedure p)))
    372     (close-output-port p)
    373     result))
     368  (let ((p (9p:open-output-file con file)))
     369    (handle-exceptions exn (begin (close-output-port p) (signal exn))
     370      (result (procedure p))
     371      (close-output-port p)
     372      result)))
    374373
    375374(define (9p:with-output-to-file con file thunk)
Note: See TracChangeset for help on using the changeset viewer.