How to correctly configure standard out/in for the Tooling API

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?

If I understand correctly, this is Or is this something different?

Yeah I guess it must be, there doesn’t seem to be a way to capture of control what appears in Standard out/err

It means we can’t provide an optimal experience in the Grails 3.0 interactive console. Would REALLY appreciate some movement on this issue.