If calling a function such as
(defun test-function () (loop for i from 1 to 10 do (format t "~a~%" i) (sleep 1)))
in the repl, I get a whole lot of nothing, and then after ten seconds, I get the output.
Which is natural, because the output stream is buffering.
So the obvious (*ahem*) thing to do is:
(setf (slot-value (slot-value (slot-value *terminal-io* 'system::output-stream) 'stream::buffer-state) 'stream::output-limit) 1)
which fixes the problem. But surely this isn't supposed to be necessary.
(This is with LispWorks 4.2.7 and current CVS Slime.)
Lars Magne Ingebrigtsen larsi@gnus.org writes:
which fixes the problem. But surely this isn't supposed to be necessary.
IMHO, flushing is the responsibility of the stream user.
Lispworks has a stream:stream-soft-force-output function. It's not documented, but I assume this is called when Lisp is idle. I added methods for comm:socket-stream and our custom output streams. This seems to solve the problem. Let's hope those methods don't infer with application code.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Lispworks has a stream:stream-soft-force-output function. It's not documented, but I assume this is called when Lisp is idle. I added methods for comm:socket-stream and our custom output streams. This seems to solve the problem.
Great; thanks.