Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

This works for me now: Wrap your read-line calls with the macro with-read-line-support which is in ns swank.core [since swank-clojure 1.4+ I believe]:

(use 'swank.core)
(with-read-line-support 
  (println "a line from Emacs:" (read-line)))

Thanks to Tavis Judd for the fix.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top