how to restart Clojurescript One repl the right way?

220 views
Skip to first unread message

George Oliver

unread,
Mar 8, 2012, 3:21:58 AM3/8/12
to Clojure
hi, I'm just starting with ClojureScript and ClojureScript One.
Sometimes working with One I kill the cljs-repl for whatever reason
(something hangs, I make some mistake and can't correct it, etcetera);
when I go to restart (by running lein repl again), I then can't
restart the cljs-repl. I get,

BindException Address already in use: JVM_Bind
java.net.PlainSocketImpl.socketBind

What's the right way to restart in this situation? Thanks.

John Collins

unread,
Mar 9, 2012, 9:24:50 PM3/9/12
to clo...@googlegroups.com



When you get a BindException error like the one you have it's probably because your ring server didn't shut down properly when your repl disconnected. I always have to resort to looking up the pid(in Linux) and killing the process running on the address:port  and running lein repl again or cljs-repl if you are still within the clojure repl. I think this situation can be remedied somehow if the server connection can be saved to a var so that a stop and start function can be called on it.

John

Pierre-Henry Perret

unread,
Mar 10, 2012, 4:36:25 AM3/10/12
to clo...@googlegroups.com
Yes, good question. It leads to another one: is ther a clojure hook  to stop the server ?

I personally kill the process to sweep out the vm and then can restart again.

Murphy McMahon

unread,
Mar 12, 2012, 1:33:37 AM3/12/12
to clo...@googlegroups.com
This is what I did on a project branched off of ClojureScript One:

https://github.com/pandeiro/multiedit/blob/multi-edit/src/app/clj/one/sample/repl.clj

It saves the server instance to an atom and adds (stop) and (restart)
functions. Just an idea. M

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Reply all
Reply to author
Forward
0 new messages