From 92a9890be23c58694c09faefff256f6544e56741 Mon Sep 17 00:00:00 2001 From: Evgenii Novozhilov Date: Thu, 12 Dec 2024 12:59:57 +0200 Subject: [PATCH] clion: fix non-passed env vars for gdbserverless debugging it wasn't checked back in the days that the change did not break the flow on mac/windows/linux with gdbserver disabled fixes #7166 --- .../idea/blaze/clwb/run/BlazeCidrLauncher.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java b/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java index f5f986a6932..c4400d20861 100644 --- a/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java +++ b/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java @@ -189,10 +189,7 @@ private ProcessHandler createProcess(CommandLineState state, List extraB final GeneralCommandLine commandLine = new GeneralCommandLine(command.toList()); - EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData(); - commandLine.withParentEnvironmentType( - envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE); - commandLine.getEnvironment().putAll(envState.getEnvs()); + updateCommandlineWithEnvironmentData(commandLine); return new ScopedBlazeProcessHandler( project, @@ -216,6 +213,13 @@ public ImmutableList createProcessListeners(BlazeContext contex }); } + private void updateCommandlineWithEnvironmentData(GeneralCommandLine commandLine) { + EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData(); + commandLine.withParentEnvironmentType( + envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE); + commandLine.getEnvironment().putAll(envState.getEnvs()); + } + @Override public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession session) throws ExecutionException { @@ -247,6 +251,9 @@ public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession commandLine.addParameters(handlerState.getExeFlagsState().getFlagsForExternalProcesses()); commandLine.addParameters(handlerState.getTestArgs()); + // otherwise is handled in createProcess + updateCommandlineWithEnvironmentData(commandLine); + if (CppBlazeRules.RuleTypes.CC_TEST.getKind().equals(configuration.getTargetKind())) { convertBlazeTestFilterToExecutableFlag().ifPresent(commandLine::addParameters); }