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.
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!