Created
January 21, 2012 00:46
-
-
Save wjlroe/1650490 to your computer and use it in GitHub Desktop.
trying to read some input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my-console.core) | |
(defn woot [] | |
(while true | |
(print "cmd > ") | |
(flush) | |
(let [cmd (read-line)] | |
(println "you entered:" cmd)))) | |
(defn -main | |
[& args] | |
(woot)) |
Might sound silly but, did you specify :main my-console.core in project.clj?
Yup, the problem here is that Leiningen is running Subprocess to launch your code, and that breaks input. So to make code like this work, you have to run lein trampoline run
to quit the leiningen vm before launching your code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what happens. It doesn't print the input: