babashka

teodorlu 2026-04-10T08:29:14.988319Z

Good morning! Thoughts on working around the Clojure pretty printer blowing up when pretty-printing babashka processes?

βœ… 1
teodorlu 2026-04-10T08:38:29.155449Z

(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!

borkdude 2026-04-10T09:54:41.460589Z

Require babashka.process,pprint

πŸ‘€ 1
❀️ 1
teodorlu 2026-04-10T10:10:30.674699Z

(defmethod pprint/simple-dispatch babashka.process.Process [proc]
  (pprint/pprint (into {} proc)))
Beautiful ☺️ Thank you!

janezj 2026-04-10T10:16:57.930299Z

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!!!

teodorlu 2026-04-10T10:26:31.188729Z

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.

janezj 2026-04-10T11:19:49.073279Z

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

teodorlu 2026-04-10T11:21:37.563959Z

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.

borkdude 2026-04-10T14:44:59.191819Z

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

πŸ‘ 1