From 92f3ad9e8261b4c142a551baaf61ef5fed84d36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20P=C3=A1ll=20Geirsson?= Date: Tue, 31 Aug 2021 09:51:39 +0200 Subject: [PATCH] Attempt 1: make sure to always flush buffered logs (#409) --- .../java/munit/internal/junitinterface/EventDispatcher.java | 3 --- .../src/main/java/munit/internal/junitinterface/JUnitTask.java | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/junit-interface/src/main/java/munit/internal/junitinterface/EventDispatcher.java b/junit-interface/src/main/java/munit/internal/junitinterface/EventDispatcher.java index 5f228dbc..a7111ccc 100644 --- a/junit-interface/src/main/java/munit/internal/junitinterface/EventDispatcher.java +++ b/junit-interface/src/main/java/munit/internal/junitinterface/EventDispatcher.java @@ -159,7 +159,6 @@ public void testRunFinished(Result result) ", " + result.getIgnoreCount()+" ignored" + ", "+result.getRunCount()+" total, "+(result.getRunTime()/1000.0)+"s") ; - logger.flush(); } runStatistics.addTime(result.getRunTime()); } @@ -174,7 +173,6 @@ public void testRunStarted(Description desc) { if (settings.verbose) { logger.info(taskInfo + " started"); - logger.flush(); } } @@ -183,7 +181,6 @@ void testExecutionFailed(String testName, Throwable err) post(new Event(Ansi.c(testName, Ansi.ERRMSG), settings.buildErrorMessage(err), Status.Error, 0L, err) { void logTo(RichLogger logger) { logger.error(ansiName+" failed: "+ansiMsg, error); - logger.flush(); } }); } diff --git a/junit-interface/src/main/java/munit/internal/junitinterface/JUnitTask.java b/junit-interface/src/main/java/munit/internal/junitinterface/JUnitTask.java index a4529ec4..2eee479b 100644 --- a/junit-interface/src/main/java/munit/internal/junitinterface/JUnitTask.java +++ b/junit-interface/src/main/java/munit/internal/junitinterface/JUnitTask.java @@ -79,6 +79,7 @@ public Task[] execute(EventHandler eventHandler, Logger[] loggers) { ed.testExecutionFailed(testClassName, ex); } } finally { + logger.flush(); settings.restoreSystemProperties(oldprops); } return new Task[0]; // junit tests do not nest