Tibor17 commented on a change in pull request #287:
URL: https://github.com/apache/maven-surefire/pull/287#discussion_r415319324



##########
File path: 
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
##########
@@ -53,19 +56,27 @@ public OutputStreamFlushableCommandline()
     public OutputStreamFlushableCommandline( String[] 
excludedEnvironmentVariables )
     {
         this.excludedEnvironmentVariables = new ConcurrentLinkedDeque<>();
+        this.addedEnvironmentVariables = new HashSet<>(  );
         Collections.addAll( this.excludedEnvironmentVariables, 
excludedEnvironmentVariables );
     }
 
+    @Override
+    public void addEnvironment( String name, String value )
+    {
+        super.addEnvironment( name, value );
+        addedEnvironmentVariables.add( name );
+    }
+
     @Override
     public final void addSystemEnvironment()
     {
         Properties systemEnvVars = CommandLineUtils.getSystemEnvVars();
 
         for ( String key : systemEnvVars.stringPropertyNames() )
         {
-            if ( !excludedEnvironmentVariables.contains( key ) )
+            if ( !addedEnvironmentVariables.contains( key ) && 
!excludedEnvironmentVariables.contains( key ) )
             {
-                addEnvironment( key, systemEnvVars.getProperty( key ) );
+                super.addEnvironment( key, systemEnvVars.getProperty( key ) );

Review comment:
       Is it so necessary to use `super`?
   If the environment is set once, it cannot be changed otherway. It is the 
original behavior in the library.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to