That's really cool and has been added to my standard system stuff :)

--Robert McIntyre

On Sat, Dec 18, 2010 at 6:46 PM, Alex Osborne <a...@meshy.org> wrote:
> Stuart Sierra <the.stuart.sie...@gmail.com> writes:
>
>> If your REPL implementation runs each command in a new Thread (as most
>> of them do, I think) it can just stop the thread.  That won't work in
>> every situation (for example, a thread blocked waiting for I/O) but it
>> will get you out of an infinite sequence.
>
> For just a plain command-line REPL on unix you can try running this
> before going into your infinite loop.  Of course if something captures
> the ThreadDeath exception then it's not going to work.
>
>  (sun.misc.Signal/handle
>   (sun.misc.Signal. "INT")
>   (let [t (Thread/currentThread)]
>    (proxy [sun.misc.SignalHandler] []
>      (handle [sig] (.stop t)))))
>
> Here's what it looks like when you hit Ctrl+C:
>
>  user=> (while true)
>  ^Cjava.lang.ThreadDeath (NO_SOURCE_FILE:0)
>  user=>
>
> Under Emacs/Slime you can achieve the same thing by hitting C-c C-b
> (or M-x slime-interrupt).
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to