I'm using Clozure Common Lisp on Windows. When using the DRIBBLE
command and evaluating some simple forms followed by closing the DRIBBLE
stream, a specified file is created but nothing is written into it.
(DRIBBLE "test.log")
(+ 2 2)
(LIST 'a 'b 'c)
(DRIBBLE)
Is this a known limitation of CCL on Windows or a problem with my environment?
If you look at the source code for dribble
(in particular, process-dribble
), you can see that CCL redirects the *TERMINAL-IO*
stream to a two-way stream. If you try to write directly to that stream (and possible call finish-output
after, to be sure), then the file is going to being written to.
> (dribble "/tmp/log")
> (print "test" *terminal-io*)
> (dribble)
The use case for dribble, at least as implemented in CCL (the behaviour of dribble is practically unspecified), is to be used from the terminal, where you cannot easily record your session. Under an IDE like Lispbox/Slime, there are other mechanisms to store commands, such as the buffer that holds the current REPL.