Fork me on GitHub

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)12:02:40

What are you looking to capture?


@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)15:02:21

if you can add an request with specific use cases, that would be helpful


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.


Thank you!

Alex Miller (Clojure team)15:02:14

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


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.


(whereas options to do exactly that do exist on process in

Alex Miller (Clojure team)15:02:42

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