jdaugherty commented on code in PR #14903:
URL: https://github.com/apache/grails-core/pull/14903#discussion_r2213349069
##########
grails-bootstrap/src/main/groovy/grails/io/support/SystemOutErrCapturer.groovy:
##########
@@ -25,32 +25,33 @@ import groovy.transform.CompileStatic
*/
@CompileStatic
class SystemOutErrCapturer {
+
ByteArrayOutputStream out
ByteArrayOutputStream err
SystemStreamsRedirector previousState
-
+
SystemOutErrCapturer capture() {
out = new ByteArrayOutputStream()
err = new ByteArrayOutputStream()
previousState = SystemStreamsRedirector.create(null, new
PrintStream(out, true), new PrintStream(err, true)).redirect()
this
}
-
+
SystemOutErrCapturer redirectToNull() {
out = null
err = null
OutputStream nullStream = new NullOutputStream()
previousState = SystemStreamsRedirector.create(null, new
PrintStream(nullStream, true), new PrintStream(nullStream, true)).redirect()
this
}
-
+
void close() {
- if(previousState != null) {
+ if (previousState != null) {
previousState.redirect()
previousState = null
}
}
-
+
public static <T> T withCapturedOutput(Closure<T> closure) {
Review Comment:
Yes, but my goal in this PR was to target java classes & do an initial
format of groovy / java. None of the groovy files have enforcement yet, since
we need to setup codenarc for that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]