maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject maven-surefire git commit: SUREFIRE_STDOUT_FLUSH
Date Wed, 15 Feb 2017 20:18:27 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/SUREFIRE_STDOUT_FLUSH [created] bff89ca61


SUREFIRE_STDOUT_FLUSH


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/bff89ca6
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/bff89ca6
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/bff89ca6

Branch: refs/heads/SUREFIRE_STDOUT_FLUSH
Commit: bff89ca6136412658c5d7fef8867bac1ef3262bf
Parents: 179abbf
Author: Tibor17 <tibor17@lycos.com>
Authored: Wed Feb 15 21:12:54 2017 +0100
Committer: Tibor17 <tibor17@lycos.com>
Committed: Wed Feb 15 21:12:54 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/maven/surefire/booter/CommandReader.java  | 6 +++++-
 .../org/apache/maven/surefire/booter/ForkingRunListener.java  | 2 ++
 .../java/org/apache/maven/surefire/booter/ForkedBooter.java   | 7 +++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bff89ca6/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
index 57f1c2c..65f49a2 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
@@ -336,7 +336,11 @@ public final class CommandReader
         private void requestNextTest()
         {
             byte[] encoded = encodeStringForForkCommunication( ( (char) BOOTERCODE_NEXT_TEST
) + ",0,want more!\n" );
-            originalOutStream.write( encoded, 0, encoded.length );
+            synchronized ( originalOutStream )
+            {
+                originalOutStream.write( encoded, 0, encoded.length );
+                originalOutStream.flush();
+            }
         }
 
         private boolean shouldFinish()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bff89ca6/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
index 1216502..7856dac 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
@@ -206,6 +206,7 @@ public class ForkingRunListener
         synchronized ( target ) // See notes about synchronization/thread safety in class
javadoc
         {
             target.write( encodeBytes, 0, encodeBytes.length );
+            target.flush();
             if ( target.checkError() )
             {
                 // We MUST NOT throw any exception from this method; otherwise we are in
loop and CPU goes up:
@@ -275,6 +276,7 @@ public class ForkingRunListener
         synchronized ( target ) // See notes about synchronization/thread safety in class
javadoc
         {
             target.write( encodeBytes, 0, encodeBytes.length );
+            target.flush();
             if ( target.checkError() )
             {
                 // We MUST NOT throw any exception from this method; otherwise we are in
loop and CPU goes up:

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bff89ca6/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index b76df2f..5cc2134 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -155,7 +155,6 @@ public final class ForkedBooter
             }
             // Say bye.
             encodeAndWriteToOutput( ( (char) BOOTERCODE_BYE ) + ",0,BYE!\n", originalOut
);
-            originalOut.flush();
             // noinspection CallToSystemExit
             exit( 0, EXIT, reader, false );
         }
@@ -228,7 +227,11 @@ public final class ForkedBooter
     private static void encodeAndWriteToOutput( String string, PrintStream out )
     {
         byte[] encodeBytes = encodeStringForForkCommunication( string );
-        out.write( encodeBytes, 0, encodeBytes.length );
+        synchronized ( out )
+        {
+            out.write( encodeBytes, 0, encodeBytes.length );
+            out.flush();
+        }
     }
 
     private static void exit( int returnCode, Shutdown shutdownType, CommandReader reader,
boolean stopReaderOnExit )


Mime
View raw message