[Openmcl-devel] print leak will crash CCL/Windows/Cocotron app when WaltConsole is missing

Gary Byers gb at clozure.com
Fri Dec 2 12:44:17 PST 2011

You presumably mean that printing to the stream which is the value of
*TERMINAL-IO* (or of synonym-streams to *terminal-io*) in the event
processs crashes on Windows unless that stream is initialized in some
meaningful way.  (That stream is ordinarily "the OS-level process's 
standard input and output"; Windows GUI processes don't haave standard
input or output.)

Since they don't, it doesn't make a lot of sense to just leave standard
input/output streams in a useless semi-initialized state if waltconsole
can't be installed on Windows.  I'll try to change that in the next day
or two; it's probably reasonable to just connect the lisp streams to the
NULL device (always EOF on input, output quietly discarded) and may be
reasonable to provide some way for an application to override that.

In the meantime, you can get somewhat more reasonable behavior by doing
something like:

(let* ((input (open "/path/to/empty/file" :direction :input))
        (output (open "/path/to/logfile" :direction :output)))
   (setq *terminal-io* (make-two-way-stream input output)))

If you wound up in the kernel debugger (or in a few other cases) you'd
still be writing to the uninitialized Windows file handle, but if a lot
of the output that you're concerned about is just printing in the event
thread it's pretty easy to create a stream in Common Lisp.

On Fri, 2 Dec 2011, Alexander Repenning wrote:

> In CCL GUI app (Coco/Cocotron), i.e., end-user applications, NOT developer
> tools, any call to print functions, or unwrapped errors, will make the
> (w)altConsole show up. This is super confusing to end-user and really of no
> help. Instructing them to type in values to continue are generally not
> appreciated. With errors wrapped up on the Mac we can just remove the
> AltConsole. Any leftover print leak will dump text into the Mac console
> which is OK. The same is not true for Cocotron Windows CCL apps. AFAIK
> removing the WaltConsole will instantly crash CCL if there is any print leak
> (accidental print perhaps due to errors). There is a not so widely known nor
> partially great Windows console that Cocotron does write to when using the
> NSLog function.?
> Is there any way to remove the WalConsole without running the risk of print
> leaks crashing the app? ?Acceptable solutions would be to just throw output
> away completely or to pipe it through NSLog. Ideally, just like on the Mac,
> this would be done by removing the WaltConsole app from the CCL windows
> bundle.
> Alex
> Prof. Alexander Repenning
> University of Colorado
> Computer Science Department
> Boulder, CO 80309-430
> vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf

More information about the Openmcl-devel mailing list