reencode-output: flush buffer on encoding error, so that the port can be closed

svn: r9528

original commit: 2837df70a6ce917b894152141a38243503b5f96b
This commit is contained in:
Matthew Flatt 2008-04-29 01:18:13 +00:00
parent 8ce36380d3
commit a46a903637

View File

@ -1428,7 +1428,7 @@
(set! ready-start 0)
(set! ready-end (- (bytes-length error-bytes) cnt))
cnt))
(decode-error "decoding error in input stream"
(decode-error "decoding error in input stream"
port)))
(unless c
@ -1733,7 +1733,7 @@
(set! ready-end (bytes-length error-bytes)))
;; Raise an exception:
(begin
(set! out-start (add1 out-start))
(set! out-start out-end) ;; flush buffer so close can work
(decode-error
"error decoding output to stream"
port))))))))
@ -1756,7 +1756,7 @@
write-it
(lambda ()
;; Flush output
(write-it #"" 0 0 #f #f)
(write-it #"" 0 0 #f #f)
(when close?
(close-output-port port))
(bytes-close-converter c))