This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-12
Channels
- # announcements (1)
- # babashka (42)
- # beginners (114)
- # bristol-clojurians (2)
- # calva (7)
- # cider (4)
- # clj-kondo (7)
- # cljs-dev (37)
- # cljsrn (13)
- # clojure (114)
- # clojure-austin (3)
- # clojure-europe (5)
- # clojure-nl (10)
- # clojure-spec (77)
- # clojure-sweden (4)
- # clojure-uk (16)
- # clojurescript (52)
- # conjure (155)
- # core-async (18)
- # cursive (23)
- # datomic (20)
- # duct (2)
- # emacs (13)
- # figwheel (3)
- # figwheel-main (9)
- # fulcro (31)
- # gis (8)
- # helix (33)
- # jobs (12)
- # jobs-discuss (66)
- # kaocha (4)
- # lein-figwheel (1)
- # meander (16)
- # off-topic (5)
- # pathom (13)
- # pedestal (6)
- # quil (6)
- # rdf (17)
- # re-frame (32)
- # reagent (34)
- # reitit (30)
- # remote-jobs (1)
- # ring (2)
- # shadow-cljs (149)
- # spacemacs (1)
- # sql (8)
- # tools-deps (90)
- # xtdb (19)
i'd like to see the bytes being exchanged between bb and a pod. is there some kind of debug functionality along these lines?
@sogaiu it all works over stdin and stdout. So you can just send some bencode to the pods stdin and watch the output
Alternatively you can use the babashka.pods library and put some printlines in there
because stdin and stdout are already being used, print didn't seem like it was going to work. what i ended up doing was this:
(defn write [^.OutputStream stream v]
(spit "/tmp/pod.log"
(str "wrote: " v "\n")
:append true)
(locking stream
(bencode/write-bencode stream v)
(.flush stream)))
(defn read [stream]
(let [res (bencode/read-bencode stream)]
(spit "/tmp/pod.log"
(str "read: " res "\n")
:append true)
res))
with appropriate rebuilding (i guess the uberjar script?) this appears to allow one to observe what's taking place between bb and a pod@sogaiu that works, but like I said, if you use the babashka.pods library you can just do this on the JVM without rebuilding
i think from where you sit it probably seems easy because you understand all of the bits already 🙂 for someone who is in the midst of trying to figure out other pieces (and someone like me with limited stack space and capability 🙂 ), it was too many uncertain pieces.
@sogaiu Changing these lines in the JVM library is easier, since you don't need to rebuild the entire babashka. it's more flexible
so changing a line in bb, compiling it with GraalVM, needing another change, compiling it again with GraalVM is more difficult then doing exactly the same thing in running a JVM program? that really doesn't make sense to me 😉
look: this test is just ran on the JVM: https://github.com/babashka/pod-babashka-filewatcher/blob/master/test/pod/babashka/filewatcher_test.clj it does exactly the same thing as within bb.
there is no disagreement about IF you understand the alternatives which one would be easier. i believe what you say. the problem is when one's stack space is full holding a lot of other details, trying to understand additional alternatives can be too much. basically, the issue is a cognitive problem on my side 🙂
@sogaiu This also works:
$ BABASHKA_POD=true clj-kondo <<< $(bb -e '(bencode/write-bencode System/out {"op" "describe"})')
d6:format3:edn2:id7:unknown10:namespacesld4:name22:pod.borkdude.clj-kondo4:varsld4:name13:merge-configsed4:name6:print!ed4:name4:run!eeeee
You can then pipe the output back into something like:
$ BABASHKA_POD=true clj-kondo <<< $(bb -e '(bencode/write-bencode System/out {"op" "describe"})') | bb -e '(bencode/read-bencode (.PushbackInputStream. System/in))'
{"format" #object["[B" 0x545ac490 "[B@105866550"], "id" #object["[B" 0x30ffb9b0 "[B@105866a48"], "namespaces" [{"name" #object["[B" 0x77363113 "[B@105867690"], "vars" [{"name" #object["[B" 0xec59d35 "[B@1058682e0"]} {"name" #object["[B" 0x4478964a "[B@105868e58"]} {"name" #object["[B" 0x34bb1efa "[B@105869ad8"]}]}]}