environment configuration for GeneralCommandLine
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 11 Sep 2015 16:24:15 +0000 (19:24 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 11 Sep 2015 16:24:15 +0000 (19:24 +0300)
platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesData.java

index 9550f29db3857232056f08f79f91c0bc59048470..1799a3d03cc6f08af5d1c389279881e7052aa308 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.execution.configuration;
 
 import com.google.common.collect.ImmutableMap;
+import com.intellij.execution.configurations.GeneralCommandLine;
 import com.intellij.util.containers.ContainerUtil;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
@@ -114,6 +115,17 @@ public class EnvironmentVariablesData {
     parent.addContent(envsElement);
   }
 
+  public void configureCommandLine(@NotNull GeneralCommandLine commandLine, boolean shellParentEnvs) {
+    if (myPassParentEnvs) {
+      commandLine.withParentEnvironmentType(shellParentEnvs ? GeneralCommandLine.ParentEnvironmentType.SHELL
+                                                            : GeneralCommandLine.ParentEnvironmentType.SYSTEM);
+    }
+    else {
+      commandLine.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.NONE);
+    }
+    commandLine.withEnvironment(myEnvs);
+  }
+
   /**
    * @param envs Map instance containing user-defined environment variables
    *             (iteration order should be reliable user-specified, like {@link LinkedHashMap} or {@link ImmutableMap})