views:

115

answers:

2

So regular clojure repl works fine, (read-line) collects input, then echos it. Using lein repl though, never echoes any input characters, nor does it ever allows me to return from any stdin reading commands.

I'm sure it has something to do with rebinding in, but was wondering if there is a workaround/fix?

Thanks.

+1  A: 

Connect to the REPL via telnet.

$ lein repl
REPL started; server listening on localhost:63849.
user=> 
[1]+  Stopped                 lein repl
$ telnet localhost 63849
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
user=> (read-line)
hello
"hello"
user=>
Pedro Silva
that doesn't work here, telnet localhost *port* doesn't bring up any repl prompt. I've tried both latest release and development builds. I'm on OSX using jse 1.6, not that it matters, but just trying to see if we have equivalent configurations.
Ilya Sterin
Ubuntu with jdk 1.6 here. Check your /etc/hosts file. Is localhost bound to 127.0.0.1? Did you background the lein process correctly? Maybe try to start lein and telnet on different terminal windows? Failing that, I recommend you give `cake` (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Cake) a try.
Pedro Silva
+1  A: 

This is due to a bug in ant; it prevents the stdin stream from the subprocess it launches from being used. But the telnet trick should work since lein repl launches a socket repl server; it works fine here.

technomancy
Thanks, I'll give it a try, although this problem actually manifests in slime, my post narrowed it down to repl/swank, but telnet won't do for me. Interestingly, this problem doesn't exists in cake. Cake's (read-line) doesn't hang, rather it returns with empty string.Are you saying that I can launch lein swank and then when it gets to (read-line) and blocks, I can connect through telnet and though use that for any stdin stuff, which will then be reflected in the repl/swank?
Ilya Sterin
That is very strange; I don't understand how telnet could fail like that. But I just pushed a bugfix to lein repl, and now read-line works in the repl for me. Let me know if it works for you in the latest 1.4.0-SNAPSHOT; if not please open an issue or start a mailing list thread.
technomancy