[slime-devel] open-streams loosing a stream

Terje Norderhaug terje at in-progress.com
Mon Jun 29 01:49:21 UTC 2009


I am setting up a dedicated output stream between Swank and the  
client, with *use-dedicated-output-stream* set to T. I discovered  
that the open-streams function of swank apparently loose an open  
stream if *use-dedicated-output-stream* is non-nil:

(let* ([...]
          (dedicated-output (if *use-dedicated-output-stream*
                                (open-dedicated-output-stream
                                 (connection.socket-io connection))))
          (out (make-output-stream output-fn))
          (in (make-input-stream input-fn))
          (out (or dedicated-output out)) <---
          (io (make-two-way-stream in out))
          (repl-results (make-output-stream-for-target connection
                                                       :repl-result)))
     (when (eq (connection.communication-style connection) :spawn)
       (setf (connection.auto-flush-thread connection)
             (spawn (lambda () (auto-flush-loop out))
                    :name "auto-flush-thread")))
     (values dedicated-output in out io repl-results)))

I suppose this isn't intentional? Here is a candidate patch that  
avoids creating the output stream if there is a stream for dedicated- 
output:

diff -u slime-2009-06-28/swank.lisp slime-2009-06-28+/swank.lisp
--- slime-2009-06-28/swank.lisp 2009-06-25 00:15:03.000000000 -0700
+++ slime-2009-06-28+/swank.lisp        2009-06-28 18:17:56.000000000  
-0700
@@ -905,9 +905,8 @@
           (dedicated-output (if *use-dedicated-output-stream*
                                 (open-dedicated-output-stream
                                  (connection.socket-io connection))))
-         (out (make-output-stream output-fn))
           (in (make-input-stream input-fn))
-         (out (or dedicated-output out))
+         (out (or dedicated-output (make-output-stream output-fn)))
           (io (make-two-way-stream in out))
           (repl-results (make-output-stream-for-target connection
                                                        :repl-result)))

-- Terje Norderhaug




More information about the slime-devel mailing list