On Apr 16, 2010, at 2:06 AM, Brian Watkins wrote:

> Is there a way to interrupt the Repl when I've set to some kind of
> infinite loop without also shutting down the JVM entirely?

Yes there is. clojure-contrib includes add-break-thread! to do just that. 
Here's an example:

% java -cp 
clojure.jar:../clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar 
clojure.main
Clojure 1.2.0-master-SNAPSHOT
user=> (require 'clojure.contrib.repl-utils)
nil
user=> (clojure.contrib.repl-utils/add-break-thread!)
{1 #<WeakReference java.lang.ref.weakrefere...@7a9300cc>}
user=> (while true) ; waited a few seconds here and then pressed ctrl-c
^Cjava.lang.Exception: SIGINT (NO_SOURCE_FILE:0)
user=> 

--Steve

-- 
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