[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

opening and closing a stream



    Date: Mon, 24 Aug 1992 10:10 EDT
    From: res <bwild@fzi.de>

    I am working on a multi-frame application under CLIM 1.1 where I want  
    to send debug output to a window or to a file depending on user  
    commands.
    Example:
    (define-simac-command (com-debug-to-file ...
     ...
     (setf *debug-stream* (open (pathname "debug") :direction :output))
     ...

    (define-simac-command (com-debug-off ...
     ...
     (close *debug-stream*)
     ...

    The application opens then a file for output and should write all  
    debug output to it, but nothing happens! The file is opened, the  
    variable *debug-stream* holds the file handle but no output is  
    written. Additionally the file cannot be closed later on by a close  
    statement from within the application. Only the "Close File" command  
    from the Listener leads to a closing of the stream.
    I can't use "with-open-file" as the debug output doesn't happen  
    within one function.
    Any ideas?

Are you ever writing anything to *DEBUG-STREAM*?  If you're intending
for normal debugger output to go there, the name of that variable is
*DEBUG-IO*.  Note that this is used for both input and output, so it
generally can't be a file, although you could use MAKE-TWO-WAY-STREAM so
that its input comes from the terminal and the output goes to a file,
e.g.

(setq *debug-output* (make-broadcast-stream *debug-io* (open ...)))
(setq *debug-io* (make-two-way-stream *debug-io* *debug-output*))

By referencing the old value of *DEBUG-IO* this should be referentially
transparent.

                                                barmar