Skip to content

Commit

Permalink
clion: fix non-passed env vars for gdbserverless debugging (#7167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujohnny authored Dec 13, 2024
1 parent dbbd11b commit ddff24e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ private ProcessHandler createProcess(CommandLineState state, List<String> 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,
Expand All @@ -216,6 +213,13 @@ public ImmutableList<ProcessListener> 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 {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ddff24e

Please sign in to comment.