From 504a7b959daf341d1b082041c27b0aeddf956f48 Mon Sep 17 00:00:00 2001 From: Tomasz Pasternak Date: Tue, 27 Feb 2024 22:44:42 +0100 Subject: [PATCH] fix: Enviroment Variables are not correctly inherited from system on MacOS (#6164) Use CONSOLE ParentEnvironmentType instead of SYSTEM CONSOLE is the default value initialized in GeneralCommandLineso it was used before. Now, if we want to inherit the system envs we use SYSTEM, so in both cases it differs from what was there before. This PR just brings the old behavior in case a user wants to inherit enviroment from the system. https://github.com/JetBrains/intellij-community/blob/9838665ba816fc8ce06e4071aa5a906a35fbb22e/platform/platform-util-io/src/com/intellij/execution/configurations/GeneralCommandLine.java#L85C1-L86C1 fixes #6163 --- .../BlazeCommandGenericRunConfigurationRunner.java | 2 +- .../google/idea/blaze/java/run/BlazeJavaRunProfileState.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java b/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java index 0a86648b3c7..779dd8050eb 100644 --- a/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java +++ b/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java @@ -199,7 +199,7 @@ private ProcessHandler getScopedProcessHandler( commandLine.withEnvironment(envVarState.getEnvs()); commandLine.withParentEnvironmentType( envVarState.isPassParentEnvs() - ? GeneralCommandLine.ParentEnvironmentType.SYSTEM + ? GeneralCommandLine.ParentEnvironmentType.CONSOLE : GeneralCommandLine.ParentEnvironmentType.NONE); return new ScopedBlazeProcessHandler( project, diff --git a/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java b/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java index 991489b5901..e0315c31cc0 100644 --- a/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java +++ b/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java @@ -291,7 +291,7 @@ private ProcessHandler getScopedProcessHandler( commandLine.withEnvironment(envVarState.getEnvs()); commandLine.withParentEnvironmentType( envVarState.isPassParentEnvs() - ? GeneralCommandLine.ParentEnvironmentType.SYSTEM + ? GeneralCommandLine.ParentEnvironmentType.CONSOLE : GeneralCommandLine.ParentEnvironmentType.NONE); return new ScopedBlazeProcessHandler( project,