> I just added a couple functions to clojure.contrib.repl-utils in an
> attempt to support Ctrl-C:
>
>  user=> (use 'clojure.contrib.repl-utils)
>  nil
>  user=> (add-break-thread!)
>  {1 #<WeakReference java.lang.ref.weakrefere...@e29820>}
>
> This registers the current thread to be stopped next time an INT
> signal is recieved, which happens when the user presses Ctrl-C.  Try
> this:
>
>  user=> (Thread/sleep 10000)
>
> Then press Ctrl-C before the 10 seconds are up, and you'll see:
>
>  java.lang.Exception: SIGINT (NO_SOURCE_FILE:0)
>  user=>
>
> ...and you're back at the repl so you can try something else.  This
> works for busy loops and should work for IO and other blocking
> behavior.

Sweet, that is slicker than my solution.  It works for me seamlessly  
in SLIME at the inferior-lisp REPL.  For expressions typed at the  
slime-repl I have to switch to the inferior-lisp buffer to send the C- 
C C-C signal, which also kills the slime-repl in the process.  Anyway,  
the Lisp process seems to survive, and I can easily start a new REPL,  
so this isn't the end of the world.

Thanks!
Jason


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to