a simple question - how can I cancel a blocking action in the repl? I am testing some async code and ran (a/<!! my-chan-i-thought-had-a-thing-on-it)
but alas, my code has a problem and that channel doesn't have a thing so now my repl is sitting waiting for something to be put on it. ctrl-c
and ctrl-d
don't seem to get through, and my google-fu has failed me on finding an answer that is more amenable than killing the repl from top
which repl? @robertfrederickwarner there are multiple repls clients available (clj / clojure.main, nrepl in tty, socket repl via nc/telnet, nrepl in emacs/vim/cider etc.) and each supports different interactions
all but the clj / clojure.main version support opening a parallel connection to the same process and just using that one
especially when doing async / threaded code / anything which might be blocking in a concurrent context I like to have at least two repls open to the same vm
this is a straight repl started up with lein repl :start
, I have my vim connected to it via nrepl but I do most of my interaction directly in the repl
you can use lein repl :connect <port>
to have a new connection to the same vm
and usually with lein repl, Control-c will kill the top level form without shutting down the entire process
yeah, I find Ctrl-c will usually do the trick which is why I was suprised it didn't work. Good to know about starting up a second repl, i'll try that out. I think i'll also put in a little helper function in my dev ns to make it easy to do a "take without timeout"