functions that read input from the keyboard don't work with reply in nrepl mode #119

Open
benwbooth opened this Issue Jul 14, 2013 · 1 comment

2 participants

@benwbooth

I have a function that allows the user to type in a password from the keyboard:

(defn read-password [& [prompt]]
  (String. (.readPassword (System/console) "%s"
                          (into-array Object [(or prompt "Enter password: ")]))))

This works fine in the normal clojure command line but not in lein repl. It returns after the first character typed instead of letting me type in the rest of the password and hit Enter. I'm sure this has something to do with the fact that this command is being run on the nrepl server process, but I was wondering if there is some workaround to make this work, at least in cases where the client and server are connected to the same terminal.

@trptcolin
Owner

Hmm, yeah, seems like it's got to be something specific to REPLy's nREPL implementation, nREPL itself, because it works when I use the non-nREPL mode... I don't know much about System.console, unfortunately - not sure how to work around this. Ideas welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment