This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-06
Channels
- # aleph (70)
- # announcements (9)
- # babashka (43)
- # babashka-sci-dev (6)
- # beginners (97)
- # cider (2)
- # clj-commons (3)
- # clj-kondo (41)
- # clojure (88)
- # clojure-europe (44)
- # clojure-nl (2)
- # clojure-spec (22)
- # clojurescript (65)
- # community-development (6)
- # conjure (10)
- # cursive (6)
- # datahike (13)
- # datomic (4)
- # eastwood (11)
- # events (1)
- # fulcro (45)
- # graalvm (1)
- # graphql (3)
- # hyperfiddle (3)
- # integrant (7)
- # jobs (1)
- # lambdaisland (1)
- # lsp (58)
- # nbb (4)
- # nrepl (3)
- # pathom (15)
- # shadow-cljs (27)
- # tools-deps (1)
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
@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* %))]))
👍 1