Hi All,
I've been working on my first little clojure project for the past couple of days, but have now run into a problem with leiningen and was hoping someone could point me in the right direction to find a solution.
I'm using lein 1.7.0, clojure 1.3.0 and openJDK 6 on a ubuntu based system.
My code has a simple loop iin the -main funciton which calls read-line to get the input.
If I run lein repl, execute (-main), I can enter data
If I create an uberjar, and run it, I can enter data
However, if I use lein run, I cannot eneter any data. It appears the program enters the while loop, but when I try to enter data, nothing happens - no characters are echoed to the screen (as is the case in the other two invokations) and it appears that the program is waiting for input from some other input source.
My guess is that lein run does something different wrt *in*, but I've no idea what and cannot find anything obvious in the docs.
My project file is very simple -
(defproject clj-espeak "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:java-source-path "java"
:ant [clj-espeak.core]
:main clj-espeak.core)
The java-source-path is necessary for some java interface classes for a JNI based interface to a C based text to speech library. This seems to be working fine.
My -main funciton is very simple
(defn -main [& args]
(println "Starting interpreter")
(tts-initialize)
(println "Starting command loop.....")
(flush)
(while true
(dispatch (parse-input (read-line)))))
As mentioned, this is my first clojure program. I'm also not a java programmer (though I did do some java back in the late 90's using java 1.0). I'm hoping it is just something obvious I've missed and would appreciate any suggestions.
Background
The reason I want to use lein run is that I want to execute the program via a shell script which is called by emacs. Emacs then communicates with this sub-process via standard input. The data it sends are commands to generate various bits of speech from text. Eventually, the aim is to have emacs start the clojure applicaiton, which will setup swank and also listen for input from emacs. I will then use slime to connect to the running process so that I can futher develop/refine the clojure code based on the input recieved from emacs. This is all part of developing a clojure based speech server for the emacspeak program.
TIA
Tim