core-async

robertfw 2019-03-21T06:43:15.078300Z

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

2019-03-21T17:12:03.078700Z

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

2019-03-21T17:14:18.079400Z

all but the clj / clojure.main version support opening a parallel connection to the same process and just using that one

2019-03-21T17:16:06.080100Z

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

robertfw 2019-03-21T17:22:52.080800Z

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

2019-03-21T17:24:04.081200Z

you can use lein repl :connect <port> to have a new connection to the same vm

2019-03-21T17:24:54.081800Z

and usually with lein repl, Control-c will kill the top level form without shutting down the entire process

robertfw 2019-03-21T17:30:57.083500Z

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"