tools-build

2023-02-28T09:20:03.919069Z

Is there any way to capture things like stdout and stderr when you run compile-clj ? It doesn't appear any of the relevant arguments get forwarded to the underlying process call.

Alex Miller (Clojure team) 2023-02-28T12:33:40.720409Z

What are you looking to capture?

2023-02-28T15:24:06.508689Z

@alexmiller Certain kinds of warnings or output that we might want to interpret as an error. An example could be ensuring that there are no warnings if you have *warn-on-reflection* set to true. It's not an urgent need at this moment, but it is something I've done before and didn't know if there was (currently) an easy way to do something similar with this.

Alex Miller (Clojure team) 2023-02-28T15:25:21.623969Z

if you can add an https://ask.clojure.org request with specific use cases, that would be helpful

2023-02-28T15:27:10.231299Z

Ok, I've never posted there before, but I will see what I can do. In the past, this has been a crucial feature when building something that worked with a large java codebase that was oblivious to clojure's existence, where java methods might get refactored without touching the clojure code that calls them. It was nice to be able to force a build breakage in such circumstances.

2023-02-28T15:27:12.520169Z

Thank you!

Alex Miller (Clojure team) 2023-02-28T15:41:14.389559Z

by default, the parent process (the build) will inherit the io streams of the forked compilation, so you should see the error in your output from the build

2023-02-28T15:47:34.943979Z

Yes, the output is printed out. However, I don't know of easy ways to simply capture the output of the subprocess to a String or something, without reassigning System.out or System.err ... however, I'm not an expert on that, and I'll take a deeper look.

2023-02-28T15:48:07.750119Z

(whereas options to do exactly that do exist on process in tools.build)

Alex Miller (Clojure team) 2023-02-28T15:56:42.753779Z

just focus on what you need and why, I can help figure out how to make it happen