From 0f78b69e2f441f4ec614e9f495a2c46f61f8efa2 Mon Sep 17 00:00:00 2001 From: Aidan Possemiers Date: Tue, 18 Nov 2025 07:26:05 +0100 Subject: [PATCH 1/2] Fix no value environment variables in refresh.template.py Fix issue where environment variable has no value reported in bazel query. --- refresh.template.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/refresh.template.py b/refresh.template.py index 194f365e..b20c6201 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -1103,7 +1103,13 @@ def _get_cpp_command_for_files(compile_action): Undo Bazel-isms and figures out which files clangd should apply the command to. """ # Condense aquery's environment variables into a dictionary, the format you might expect. - compile_action.environmentVariables = {pair.key: pair.value for pair in getattr(compile_action, 'environmentVariables', [])} + compile_action.environmentVariables = {} + for pair in getattr(compile_action, 'environmentVariables', []): + if hasattr(pair, 'value'): + compile_action[pair.key] = pair.value + else: + compile_action[pair.key] = "" + if 'PATH' not in compile_action.environmentVariables: # Bazel only adds if --incompatible_strict_action_env is passed--and otherwise inherits. compile_action.environmentVariables['PATH'] = os.environ['PATH'] From 3f1f2c7c3da3e8b8fcb3adbf3974190b16cde66d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 06:26:52 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- refresh.template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refresh.template.py b/refresh.template.py index b20c6201..212aa83d 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -1109,7 +1109,7 @@ def _get_cpp_command_for_files(compile_action): compile_action[pair.key] = pair.value else: compile_action[pair.key] = "" - + if 'PATH' not in compile_action.environmentVariables: # Bazel only adds if --incompatible_strict_action_env is passed--and otherwise inherits. compile_action.environmentVariables['PATH'] = os.environ['PATH']