Tibor17 commented on a change in pull request #240: [SUREFIRE-1658] TCP/IP 
Channel for forked Surefire JVM. Extensions API and SPI. Polymorphism for 
remote and local process communication.
URL: https://github.com/apache/maven-surefire/pull/240#discussion_r377984084
 
 

 ##########
 File path: 
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
 ##########
 @@ -602,38 +613,44 @@ private RunResult fork( Object testSet, 
PropertiesWrapper providerProperties, Fo
         }
 
         ThreadedStreamConsumer eventConsumer = new ThreadedStreamConsumer( 
forkClient );
-        CloseableCloser closer = new CloseableCloser( forkNumber, 
eventConsumer, requireNonNull( commandInputStream ) );
+        CloseableCloser closer = new CloseableCloser( forkNumber, 
eventConsumer, commandReader );
 
         log.debug( "Forking command line: " + cli );
 
         Integer result = null;
         RunResult runResult = null;
         SurefireBooterForkException booterForkException = null;
-        StreamFeeder in = null;
-        LineConsumerThread out = null;
-        LineConsumerThread err = null;
+        CloseableDaemonThread in = null;
+        CloseableDaemonThread out = null;
+        CloseableDaemonThread err = null;
         DefaultReporterFactory reporter = 
forkClient.getDefaultReporterFactory();
         currentForkClients.add( forkClient );
-        CountdownCloseable countdownCloseable = new CountdownCloseable( 
eventConsumer, 2 );
+        CountdownCloseable countdownCloseable =
+            new CountdownCloseable( eventConsumer, 1 + ( 
forkChannel.useStdOut() ? 1 : 0 ) );
         try ( CommandlineExecutor exec = new CommandlineExecutor( cli, 
countdownCloseable ) )
         {
-            // default impl of the extension - solves everything including the 
encoder/decoder, Process starter,
-            // adaptation of the streams to pipes and sockets
-            // non-default impl may use another classes and not the 
LineConsumerThread, StreamFeeder - freedom
-            // BEGIN: beginning of the call of the extension
             CommandlineStreams streams = exec.execute();
             closer.addCloseable( streams );
-            in = new StreamFeeder( "std-in-fork-" + forkNumber, 
streams.getStdInChannel(), commandInputStream );
+
+            forkChannel.openChannel();
+
+            in = forkChannel.useStdIn()
+                ? forkChannel.bindCommandReader( commandReader, 
streams.getStdInChannel() )
 
 Review comment:
   This is a problem because the stdIn is not always used in every impl. We 
have to find useful design pattern. Once not passing the second parameter, and 
second time passing it. This can be discussed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to