I'm using "zx/question" (js library) in an nbb script. I'm trying to run it now with a repl from calva using jack-in. Script output is sent to the terminal ok but input I enter into the terminal don't seem to be received by the script. Any ideas? Thanks.
@milelo The way I usually do this, is make a function which accepts the input, then test that function in the REPL and then hook that function up to the thing that reads from stdin. Stdin + nREPL is a bit complicated
Thanks @borkdude, I was beginning to think along those lines as a work around.
@borkdude. I came up with this to solve my zx/question repl issue. An answer can also be provided by the answer function.
(def answer-listener* (atom nil))
(defn answer [answer]
(if-let [resolve @answer-listener*]
(resolve (str answer))
(println "Error: No question."))
(reset! answer-listener* nil))
(defn question [question]
(println question)
(js/Promise.any #js [(zx/question) (js/Promise. #(reset! answer-listener* %))]))