Skip to content

Commit

Permalink
clion: fix non-passed env vars for gdbserverless debugging
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ujohnny committed Dec 12, 2024
1 parent f9af31b commit 92a9890
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 92a9890

Please sign in to comment.