babashka

borkdude 2025-09-25T09:53:19.555309Z

I'm trying to reproduce a problem on Windows in powershell with unicode characters. I've made a repro in the form of this binary: https://github.com/borkdude/graal-repros/actions/runs/18003635773/artifacts/4102737916 Can any of you on Windows try to run this in Powershell 7 and tell me what it prints (screenshot would be fine too) in 🧡 ? The code for the repro is: https://github.com/borkdude/graal-repros/tree/init-at-build-time-output-writer-repro

borkdude 2025-09-26T19:04:24.175649Z

Made a GraalVM issue here about it: https://github.com/oracle/graal/issues/12249

chucklehead 2025-09-27T01:16:45.040499Z

well, after reading over that original issue, let me just take a minute to say thanks for all the amazing tools you've contributed to this community and the constant stream of improvements and fixes and new features you somehow manage to deliver in response to every passing comment.

❀️ 1
chucklehead 2025-09-25T10:19:59.507419Z

borkdude 2025-09-25T10:21:37.728239Z

Thanks! Can you try setting $OutputEncoding = [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new() and running it again?

chucklehead 2025-09-25T10:22:40.983609Z

borkdude 2025-09-25T10:23:51.529809Z

Interesting... Can you now try bb latest with this program?

(prn :> (System/getProperty "file.encoding"))

(alter-var-root #'*out* (constantly (new java.io.OutputStreamWriter System/out)))

(do
  (prn "β„’")
  (prn "Ξ»")
  (.println System/out "βš™οΈ")
  (prn "δΈ­ζ–‡"))

(binding [*out* *out* #_(java.io.OutputStreamWriter. System/out #_(java.nio.charset.Charset/forName "UTF-8"))]
  (println "βœ“ works")
  (prn "βš™οΈ"))

borkdude 2025-09-25T10:24:05.935979Z

try it with and without the alter-var-root

chucklehead 2025-09-25T10:32:21.409079Z

borkdude 2025-09-25T10:48:43.557499Z

ok, can you now uncomment in the right version the #_ in the binding and then once more (so with and without th explicit encoding)?

borkdude 2025-09-25T10:49:27.878689Z

What I'm trying to figure out is why resetting *out* to something that looks the same makes things work. My hypothesis is that init at build time of *out* somehow captures the wrong encoding. But that doesn't manifest itself in the repro.

chucklehead 2025-09-25T11:07:54.710319Z

hopefully I understood what you meant here:

πŸ‘ 1
chucklehead 2025-09-25T11:09:32.698099Z

not sure if this is expected, but I see different results with a script vs evaling:

borkdude 2025-09-25T11:16:23.555369Z

this might be expected since *out* is dynamically bound there. can you try (set! *out* ...) there instead?

borkdude 2025-09-25T11:16:51.160509Z

also try the binding with the #_ uncommented

borkdude 2025-09-25T11:21:09.420689Z

I made a "fix" in this bb binary. you can also test with that one? without the alter-var-root etc it should now work (hopefully 🀞 ) https://github.com/babashka/babashka/actions/runs/18005507477/artifacts/4103448816

chucklehead 2025-09-25T11:30:49.303719Z

looks like the variant without alter-var-root is still not working

borkdude 2025-09-25T11:33:42.658019Z

are you sure you have downloaded the binary? I couldn't in an incognito window facepalm

chucklehead 2025-09-25T11:36:08.538769Z

I believe so, it's showing version v1.12.209-SNAPSHOT.

borkdude 2025-09-25T11:36:44.581779Z

interesting. so I guess as long as you're logged in with Github you can download it

borkdude 2025-09-25T11:40:41.401489Z

ok, let me try something different\

chucklehead 2025-09-25T11:40:44.254739Z

yeah, I did have to sign in, but ran into that downloading the original repro πŸ™‚

chucklehead 2025-09-25T11:55:07.633839Z

About to start a long block of meetings so I might be even slower to respond, but happy to help try anything else.

borkdude 2025-09-25T12:02:14.965379Z

thank you!

borkdude 2025-09-25T18:01:34.161009Z

This one worked for me no matter what I did (alter-var-root etc): https://github.com/babashka/babashka/actions/runs/18006768113/artifacts/4103894502 I still had to set the UTF-8 output in powershell though.

borkdude 2025-09-25T18:04:01.646769Z

$OutputEncoding = [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()

chucklehead 2025-09-25T20:06:32.833079Z

looks good

πŸŽ‰ 1
igrishaev 2025-09-25T11:42:59.094949Z

I'm completely new to Babashka, and have a question: does it support extending a defrecord with a java interface? Asking because tests fail on CI when running under Babashka runtime:

(defrecord Foobar [key value]
  ^--- defrecord/deftypecurrently only support protocol implementations,
  ^--- found: clojure.lang.Indexed
  clojure.lang.Indexed
  (nth [_ i]
    (case (long i)...

borkdude 2025-09-25T11:43:33.263739Z

no, it doesn't support it, which the error message attempts to convey but apparently not successfully :)

borkdude 2025-09-25T11:44:07.846299Z

(it's not that bb doesn't want t support it but it can't due to limitations of graalvm)

igrishaev 2025-09-25T11:44:09.414029Z

No-no it's pretty clear, I was asking just to ensure

ericdallo 2025-09-25T20:08:39.499079Z

I'm building a simple MCP server mock for integration testing #eca using MCP java sdk library. I'm facing a Unable to resolve classname: com.fasterxml.jackson.databind.ObjectMapper , just throwing here if anyone knows if ObjectMapper class can be used with bb

βœ… 1
ericdallo 2025-09-25T20:09:15.178219Z

I see it in bb print-deps --format classpath

ericdallo 2025-09-25T20:09:30.270489Z

and I'm using like

(ns mcp-server-sample.main
  (:import
   [com.fasterxml.jackson.databind ObjectMapper]
   [io.modelcontextprotocol.server.transport StdioServerTransportProvider]))

(StdioServerTransportProvider. (ObjectMapper.))

ericdallo 2025-09-25T20:15:50.447239Z

Nvm, I found a constructor that didn't need the objectMapper but now I'm facing the same but for https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/server/McpServer.java class

ericdallo 2025-09-25T20:16:00.134649Z

Maybe it's just not bb compatible

ericdallo 2025-09-25T20:16:07.472029Z

not sure I need to do anything

ericdallo 2025-09-25T20:21:08.955919Z

Actually it's not finding any class from mcp java sdk, maybe bb doesn't allow third party java libs?

borkdude 2025-09-25T20:41:19.522349Z

no third party java libs unless included in the image

borkdude 2025-09-25T20:42:08.922709Z

you can still use regular clojure though :)

ericdallo 2025-09-25T20:42:52.794279Z

yeah, I went with that in the end hehe Too used to use bb for everything πŸ˜…

❀️ 1
borkdude 2025-09-25T21:07:57.140609Z

If any of you had a problem with Unicode in powershell (7) on Windows with bb, give this a try: https://github.com/babashka/babashka/issues/1009#issuecomment-3335943986

πŸ‘€ 2
πŸš€ 3