reconnecting and *GLOBALLY-REDIRECT-IO*

Gábor Melis mega at retes.hu
Mon Nov 23 16:18:25 UTC 2015


On Mon, Nov 23, 2015 at 3:53 PM, Luís Oliveira <luismbo at gmail.com> wrote:
> On Mon, Nov 23, 2015 at 9:44 AM, Gábor Melis <mega at retes.hu> wrote:
>> This was on SBCL. Sorry for omitting that detail.
>
> It's working for me on SBCL 1.3.0 and latest SLIME. Let's try and
> codify the test case a bit further to see if we can find what differs
> between our setups.
>
> SBCL side:
>
>     $ echo "(defparameter swank:*globally-redirect-io* t)" > ~/.swank.lisp
>     $ sbcl --eval '(require :swank)' \
>            --eval '(swank:create-server :port 4095 :dont-close t)' \
>            --eval '(loop (format t "~S~%" *standard-output*) (sleep 2))'
>     This is SBCL 1.3.0, an implementation of ANSI Common Lisp.
>     More information about SBCL is available at <http://www.sbcl.org/>.
>
>     SBCL is free software, provided as is, with absolutely no warranty.
>     It is mostly in the public domain; some portions are provided under
>     BSD-style licenses.  See the CREDITS and COPYING files in the
>     distribution for more information.
>     ;; Swank started at port: 4095.
>     #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {912A129}>
>     #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {912A129}>
>
>     [ .. and so on ..]
>
> Emacs side:
>
>     $ emacs -q --eval "(add-to-list 'load-path \"~/src/lisp/slime\")" \
>             --eval "(setq slime-contribs '(slime-repl))" \
>             --eval "(require 'slime)" \
>             --eval "(slime-connect \"127.0.0.1\" 4095)"
>
> And I get this on the REPL:
>
>     #<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-STANDARD-OUTPUT* {B87C301}>
>
> After `M-x slime-disconnect', I get this on SBCL:
>
>     ;; swank:close-connection: end of file on #<SB-SYS:FD-STREAM for
> "socket 127.0.0.1:4095, peer: 127.0.0.1:58832" {B54FB29}>
>     #<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-STANDARD-OUTPUT* {B87C301}>
>
> Running the emacs command again gets me the same output in the
> REPL. Were you doing anything different?

Yes, the above works. It also works if I start a thread from the Slime
repl like this:

(sb-thread:make-thread
 (lambda ()
   (loop
     (format t "~S~%" *standard-output*)
     (sleep 2))))

On the other hand, if I evaluate the loop from a lisp buffer such as
*slime-scratch* then it doesn't. So start sbcl like this:

     $ echo "(defparameter swank:*globally-redirect-io* t)" > ~/.swank.lisp
     $ sbcl --eval '(require :swank)' \
            --eval '(swank:create-server :port 4095 :dont-close t)'

Start slime exactly as you did:

     $ emacs -q --eval "(add-to-list 'load-path \"~/src/lisp/slime\")" \
             --eval "(setq slime-contribs '(slime-repl))" \
             --eval "(require 'slime)" \
             --eval "(slime-connect \"127.0.0.1\" 4095)"

Then switch to *slime-scratch* and evaluate with C-x C-e the loop
form. The output goes to the repl regardless of
*globally-redirect-io*. Now disconnect, reconnect and there is no more
output although the thread is still there.

> Random question: do you have :SB-THREAD in your *FEATURES*?

Yes.



More information about the slime-devel mailing list