tools-build

2025-07-28T19:43:31.040199Z

I opened https://ask.clojure.org/index.php/14648/tools-build-compile-clj-capture-out-err but thought I'd share here in case others have run into this. I have a failing b/compile-clj call which throws the exception "Clojure compilation failed, working dir preserved: ...". This is helpful to see the contents of the call but not super helpful with knowing exactly what went wrong. Given that the process/process call can redirect to :out and :err (as provided by the user), I would find it helpful for debugging to get the contents of those in the ex-data of the thrown exception.

2025-07-29T13:47:41.653459Z

do i need a test for this? i'm not sure how to write one lol

Alex Miller (Clojure team) 2025-07-29T13:51:40.101969Z

nah

👍 1
2025-07-29T13:57:50.313529Z

updated the ticket, added a patch

👍 1
Alex Miller (Clojure team) 2025-07-29T14:27:33.172599Z

pushed and released as 0.10.10

🎉 1
Alex Miller (Clojure team) 2025-07-29T14:27:38.790809Z

thx!

2025-07-29T14:27:46.801119Z

yo! thank you!

Alex Miller (Clojure team) 2025-07-29T14:29:22.455629Z

thank you!

Alex Miller (Clojure team) 2025-07-28T19:49:53.407089Z

aren't stdout and stderr inherited and printed already?

Alex Miller (Clojure team) 2025-07-28T19:52:05.439419Z

in normal usage from cli, I think you'll see compile errors and stuff. is that how you're using it or some other way?

Alex Miller (Clojure team) 2025-07-28T19:55:56.601089Z

re-reading, I see what you're saying, but still curious to know a little more on how you're using it

2025-07-28T19:56:58.740059Z

I'm capturing :out and :err so I can check for Reflection warnings, and if there's no compilation error, this works great. But when there is a compilation error, :out and :err aren't returned.

2025-07-28T19:57:23.629129Z

I could wrap in a try-catch and then call .str on them there, but that feels hacky

Alex Miller (Clojure team) 2025-07-28T19:57:56.316569Z

makes sense, I can make a jira if you want to send me a patch

👍 1
2025-07-28T19:57:57.154009Z

actually, I'm writing {:out :capture :err :capture} so I'd first need to pass in my own stringwriter

2025-07-28T19:58:12.914479Z

sure, I can do that

2025-07-28T19:58:20.966379Z

Should only be two lines

Alex Miller (Clojure team) 2025-07-28T20:01:31.601549Z

https://clojure.atlassian.net/browse/TBUILD-46

Alex Miller (Clojure team) 2025-07-28T20:01:37.075439Z

probably 3 lines

Alex Miller (Clojure team) 2025-07-28T20:01:37.296099Z

;