Skip to content
Snippets Groups Projects
Commit 2e9803cc authored by Attila Lendvai's avatar Attila Lendvai
Browse files

fix force-output/finish-output thinko in io.lisp

parent 74b93468
No related branches found
No related tags found
No related merge requests found
...@@ -61,18 +61,18 @@ possible values." ...@@ -61,18 +61,18 @@ possible values."
(write-sequence string file-stream))) (write-sequence string file-stream)))
(defun copy-file (from to &key (if-to-exists :supersede) (defun copy-file (from to &key (if-to-exists :supersede)
(element-type '(unsigned-byte 8)) force-output) (element-type '(unsigned-byte 8)) finish-output)
(with-input-from-file (input from :element-type element-type) (with-input-from-file (input from :element-type element-type)
(with-output-to-file (output to :element-type element-type (with-output-to-file (output to :element-type element-type
:if-exists if-to-exists) :if-exists if-to-exists)
(copy-stream input output (copy-stream input output
:element-type element-type :element-type element-type
:force-output force-output)))) :finish-output finish-output))))
(defun copy-stream (input output &key (element-type (stream-element-type input)) (defun copy-stream (input output &key (element-type (stream-element-type input))
(buffer-size 4096) (buffer-size 4096)
(buffer (make-array buffer-size :element-type element-type)) (buffer (make-array buffer-size :element-type element-type))
force-output) finish-output)
"Reads data from INPUT and writes it to OUTPUT. Both INPUT and OUTPUT must "Reads data from INPUT and writes it to OUTPUT. Both INPUT and OUTPUT must
be streams, they will be passed to READ-SEQUENCE and WRITE-SEQUENCE and must have be streams, they will be passed to READ-SEQUENCE and WRITE-SEQUENCE and must have
compatible element-types." compatible element-types."
...@@ -82,5 +82,5 @@ compatible element-types." ...@@ -82,5 +82,5 @@ compatible element-types."
:do (write-sequence buffer output) :do (write-sequence buffer output)
:finally (progn :finally (progn
(write-sequence buffer output :end bytes-read) (write-sequence buffer output :end bytes-read)
(when force-output (when finish-output
(force-output output))))) (finish-output output)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment