Skip to content

Commit d08c66c

Browse files
committed
Output compiler verbose log messages to stderr rather than stdout
1 parent 9ec5054 commit d08c66c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

java-compiler-testing/src/main/java/io/github/ascopes/jct/compilers/impl/JctCompilationFactoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private JctCompilation createCheckedCompilation(
9696
}
9797

9898
// Do not close stdout, it breaks test engines, especially IntellIJ.
99-
var writer = TeeWriter.wrapOutputStream(System.out, compiler.getLogCharset());
99+
var writer = TeeWriter.wrapOutputStream(System.err, compiler.getLogCharset());
100100

101101
var diagnosticListener = new TracingDiagnosticListener<>(
102102
compiler.getDiagnosticLoggingMode() != LoggingMode.DISABLED,

java-compiler-testing/src/test/java/io/github/ascopes/jct/tests/unit/compilers/impl/JctCompilationFactoryImplTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ void anErrorIsRaisedIfNoCompilationUnitsAreFound() throws IOException {
335335
verifyNoInteractions(javaCompiler);
336336
}
337337

338-
@DisplayName("The compiler should write logs to System.out")
338+
@DisplayName("The compiler should write logs to System.err")
339339
@Test
340-
void theCompilerShouldWriteLogsToSystemOut() throws IOException {
340+
void theCompilerShouldWriteLogsToSystemErr() throws IOException {
341341
// Given
342342
try (var teeWriterStatic = mockStatic(TeeWriter.class)) {
343343
var teeWriter = mock(TeeWriter.class);
@@ -356,7 +356,7 @@ void theCompilerShouldWriteLogsToSystemOut() throws IOException {
356356

357357
// Then
358358
teeWriterStatic.verify(() -> TeeWriter.wrapOutputStream(
359-
System.out,
359+
System.err,
360360
jctCompiler.getLogCharset()
361361
));
362362
teeWriterStatic.verifyNoMoreInteractions();

0 commit comments

Comments
 (0)