I’m dealing with a bit of a complex problem, we are using the tooling API to launch Gradle. During this step we populate a custom standardOutput and standardError by setting them on the LongRunningOperation
class:
operation.standardOutput = new GrailsConsolePrintStream( grailsConsole.out )
operation.standardError = new GrailsConsoleErrorPrintStream( grailsConsole.err )
Grade using JavaExec then launches a child JVM to run the application which is a web application. When an error occurs in the web application it logs to System.err in this child JVM which Gradle than propagates to the current terminal.
This output that is written by System.err I would like to be handled by our custom GrailsConsoleErrorPrintStream
but it seems to go directly to the normal standard out which messes up the Grails interactive console state a bit (the prompt disappears).
How does one correctly configure System.out and System.err so that Gradle launched via the Tooling API passes any output through out custom implementations or am I asking too much?