You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/08/02 16:07:14 UTC

[royale-compiler] 01/02: RoyaleUnit: Fix Windows test runs that failed to run Playwright because the environment variables were too long

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 0b4edfc1b2ac20d58a8183113010d2e493a7ca05
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Aug 2 08:57:33 2022 -0700

    RoyaleUnit: Fix Windows test runs that failed to run Playwright because the environment variables were too long
---
 .../playwright/DefaultPlaywrightCommand.java       | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/royaleunit-ant-tasks/src/main/java/org/apache/royale/test/ant/launcher/commands/playwright/DefaultPlaywrightCommand.java b/royaleunit-ant-tasks/src/main/java/org/apache/royale/test/ant/launcher/commands/playwright/DefaultPlaywrightCommand.java
index 670ca5594..c591f34bf 100644
--- a/royaleunit-ant-tasks/src/main/java/org/apache/royale/test/ant/launcher/commands/playwright/DefaultPlaywrightCommand.java
+++ b/royaleunit-ant-tasks/src/main/java/org/apache/royale/test/ant/launcher/commands/playwright/DefaultPlaywrightCommand.java
@@ -87,7 +87,7 @@ public class DefaultPlaywrightCommand implements PlaywrightCommand
         ((AntClassLoader)getClass().getClassLoader()).setThreadContextLoader();
 
         CreateOptions createOptions = new CreateOptions();
-        createOptions.setEnv(getJointEnvironment());
+        createOptions.setEnv(getEnvironmentMap());
         playwright = PlaywrightImpl.create(createOptions);
     }
     
@@ -150,30 +150,18 @@ public class DefaultPlaywrightCommand implements PlaywrightCommand
         environment = variables;
     }
 
-    /**
-     * Combine process environment variables and command's environment to emulate the default
-     * behavior of the Execute task.  Needed especially when user expects environment to be 
-     * available to custom command (e.g. - xvnc with player not on path).
-     */
     @SuppressWarnings("unchecked")
-    private Map<String,String> getJointEnvironment()
+    private Map<String,String> getEnvironmentMap()
     {
-        Map<String, String> jointEnvironment = new HashMap<String, String>();
-        Vector<String> executeProcEnvironment = Execute.getProcEnvironment();
-        String[] procEnvironment = executeProcEnvironment.toArray(new String[0]);
-        for (String envVar : procEnvironment)
-        {
-            String[] parts = envVar.split("=");
-            jointEnvironment.put(parts[0].trim(), parts.length > 1 ? parts[1].trim() : "");
-        }
+        Map<String, String> result = new HashMap<String, String>();
         if (environment != null)
         {
             for (String envVar : environment)
             {
                 String[] parts = envVar.split("=");
-                jointEnvironment.put(parts[0].trim(), parts.length > 1 ? parts[1].trim() : "");
+                result.put(parts[0].trim(), parts.length > 1 ? parts[1].trim() : "");
             }
         }
-        return jointEnvironment;
+        return result;
     }
 }