- open-file-output-port now understands "none" as a buffer-mode.
Previously, all output ports were unbuffered. - the console error port is made unbuffered. The following program: (begin (write-char #\a (current-output-port)) (write-char #\b (current-error-port)) (write-char #\c (current-output-port))) now prints "bac" when run from the repl, when it used to only print "ac" (the b just sat in the error port).
This commit is contained in:
parent
8844e118b8
commit
c464e8ebce
|
@ -1417,7 +1417,6 @@
|
||||||
#t
|
#t
|
||||||
'open-file-input-port)]))
|
'open-file-input-port)]))
|
||||||
|
|
||||||
|
|
||||||
(define open-file-output-port
|
(define open-file-output-port
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[(filename)
|
[(filename)
|
||||||
|
@ -1427,20 +1426,21 @@
|
||||||
[(filename file-options buffer-mode)
|
[(filename file-options buffer-mode)
|
||||||
(open-file-output-port filename file-options buffer-mode #f)]
|
(open-file-output-port filename file-options buffer-mode #f)]
|
||||||
[(filename file-options buffer-mode transcoder)
|
[(filename file-options buffer-mode transcoder)
|
||||||
|
(define who 'open-file-output-port)
|
||||||
(unless (string? filename)
|
(unless (string? filename)
|
||||||
(die 'open-file-output-port "invalid filename" filename))
|
(die who "invalid filename" filename))
|
||||||
; FIXME: file-options ignored
|
; FIXME: file-options ignored
|
||||||
; FIXME: buffer-mode ignored
|
; FIXME: line-buffered output ports are not handled
|
||||||
(unless (or (not transcoder) (transcoder? transcoder))
|
(unless (or (not transcoder) (transcoder? transcoder))
|
||||||
(die 'open-file-output-port "invalid transcoder" transcoder))
|
(die who "invalid transcoder" transcoder))
|
||||||
(fh->output-port
|
(let ([buffer-size
|
||||||
(open-output-file-handle filename file-options
|
(case buffer-mode
|
||||||
'open-file-output-port)
|
[(none) 1]
|
||||||
filename
|
[(block line) output-file-buffer-size]
|
||||||
output-file-buffer-size
|
[else (die who "invalid buffer mode" buffer-mode)])])
|
||||||
transcoder
|
(fh->output-port
|
||||||
#t
|
(open-output-file-handle filename file-options who)
|
||||||
'open-file-output-port)]))
|
filename buffer-size transcoder #t who))]))
|
||||||
|
|
||||||
(define (open-output-file filename)
|
(define (open-output-file filename)
|
||||||
(unless (string? filename)
|
(unless (string? filename)
|
||||||
|
@ -1565,7 +1565,7 @@
|
||||||
(define *the-error-port*
|
(define *the-error-port*
|
||||||
(make-parameter
|
(make-parameter
|
||||||
(transcoded-port
|
(transcoded-port
|
||||||
(fh->output-port 2 '*stderr* output-file-buffer-size #f #f #f)
|
(fh->output-port 2 '*stderr* 1 #f #f #f)
|
||||||
(native-transcoder))))
|
(native-transcoder))))
|
||||||
|
|
||||||
(define console-output-port
|
(define console-output-port
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1634
|
1635
|
||||||
|
|
Loading…
Reference in New Issue