Good morning! Thoughts on working around the Clojure pretty printer blowing up when pretty-printing babashka processes?
(require '[babashka.process :as p])
(p/shell {:out :string
:err :string
:continue true} "echo hello, babashka!")
;; ... try to pretty print, then ....
;; => Error printing return value (IllegalArgumentException) at clojure.lang.MultiFn/findAndCacheBestMethod (MultiFn.java:179).
;; Multiple methods in multimethod 'simple-dispatch' match dispatch value: class babashka.process.Process -> interface clojure.lang.IDeref and interface clojure.lang.IPersistentMap, and neither is preferred
I could
(require 'clojure.pprint)
(prefer-method clojure.pprint/simple-dispatch clojure.lang.IPersistentMap clojure.lang.IDeref)
, but using prefer-method on Clojure things I don't control leaves a sour taste in my mouth.
Would love to hear if others are doing the same for printing p/shell and p/process output, or if there are different options!Require babashka.process,pprint
(defmethod pprint/simple-dispatch babashka.process.Process [proc]
(pprint/pprint (into {} proc)))
Beautiful βΊοΈ Thank you!I want to reference some tasks and while experimenting I found some combinations that I don't understand in bb.skills (def skill-tasks {:task (println "task"}) :tasks {:requires ([bb.skills :as skills]) ;skills (fn [] ((skills/skills-task))) ;; ok, but why it is a map ;skills (fn [] skills/skills-task) ;; ok ;skills (fn [] (('skills-task))) ;; ok how, why ??? ;skills skills/skills-task ;; err ;skills 'skills/skills-task ;; err skills 'skills-task ;; ok ;; why!!!
Hello! First, some suggestions;
1. Please format code with block quote formatting! That's easier to read π
2. Please put details in threads! Lots of people follow this channel, and prefer to "scan over" threads they aren't interested in.
Onto your problem. bb.skills is something you've created yourself, right? Babashka tasks just call your code, so this is a matter of understanding that code.
How do you run bb.skills/skills-task from the REPL?
If we start with a working REPL expression, we can quickly get that running from a Babashka task.
This is bb.edn and I am referencing the whole task from another namespace. And it works but in an unexpected way. It works without namespace as it was required
It's still not clear to me how you actually want to call your code, or what your problem is! I don't understand what you expect to see from your bb.edn file, because I don't know what the code you're calling looks like.
in bb edn you use {:task foo.bar/baz} notation, but you don't use (def foo {:task foo.bar/baz} in a normal code file. The :task syntax is only understood by bb tasks in bb.edn