cs: remove plumber flush callback when custodian closes fd output port
Previously, the following program would print "error writing to stream port" on program exit. (define cust (make-custodian)) (define out (parameterize ((current-custodian cust)) (open-output-file "test.data" #:exists 'truncate))) (write-string "This needs flushing...\n" out) (custodian-shutdown-all cust) (exit 0)
This commit is contained in:
parent
ddba2812ba
commit
e8832fbcc7
|
@ -87,7 +87,7 @@
|
||||||
[() (buffer-control)]
|
[() (buffer-control)]
|
||||||
[(pos) (buffer-control pos)]))))
|
[(pos) (buffer-control pos)]))))
|
||||||
(define custodian-reference
|
(define custodian-reference
|
||||||
(register-fd-close cust fd fd-refcount port))
|
(register-fd-close cust fd fd-refcount #f port))
|
||||||
port)
|
port)
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
[(mode) (set! buffer-mode mode)])))
|
[(mode) (set! buffer-mode mode)])))
|
||||||
|
|
||||||
(define custodian-reference
|
(define custodian-reference
|
||||||
(register-fd-close cust fd fd-refcount port))
|
(register-fd-close cust fd fd-refcount flush-handle port))
|
||||||
|
|
||||||
(set-fd-evt-closed! evt (core-port-closed port))
|
(set-fd-evt-closed! evt (core-port-closed port))
|
||||||
|
|
||||||
|
@ -331,12 +331,14 @@
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
(define (register-fd-close custodian fd fd-refcount port)
|
(define (register-fd-close custodian fd fd-refcount flush-handle port)
|
||||||
(define closed (core-port-closed port))
|
(define closed (core-port-closed port))
|
||||||
(unsafe-custodian-register custodian
|
(unsafe-custodian-register custodian
|
||||||
fd
|
fd
|
||||||
;; in atomic mode
|
;; in atomic mode
|
||||||
(lambda (fd)
|
(lambda (fd)
|
||||||
|
(when flush-handle
|
||||||
|
(plumber-flush-handle-remove! flush-handle))
|
||||||
(fd-close fd fd-refcount)
|
(fd-close fd fd-refcount)
|
||||||
(set-closed-state! closed))
|
(set-closed-state! closed))
|
||||||
#f
|
#f
|
||||||
|
|
Loading…
Reference in New Issue
Block a user