[Lldb-commits] [lldb] 48e0e16 - [lldb-dap] extend env when testing reverse request (#193743)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 24 06:08:34 PDT 2026
Author: Charles Zablit
Date: 2026-04-24T14:08:29+01:00
New Revision: 48e0e16886f96e80de2f3390785ef7a373b562bc
URL: https://github.com/llvm/llvm-project/commit/48e0e16886f96e80de2f3390785ef7a373b562bc
DIFF: https://github.com/llvm/llvm-project/commit/48e0e16886f96e80de2f3390785ef7a373b562bc.diff
LOG: [lldb-dap] extend env when testing reverse request (#193743)
When testing lldb-dap's "runInTerminal" mode, the `"env"` argument is
meant to extend/override the current environment, not replace it.
This causes issues on Windows when Python is not in the System's Path.
The reverse request fails because lldb-dap can't find Python.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 5b23b921d2957..c8acf67b23b99 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -506,7 +506,11 @@ def _handle_reverse_request(self, request: Request) -> None:
if request["command"] == "runInTerminal" and arguments is not None:
assert self.spawn_helper is not None, "Not configured to spawn subprocesses"
[exe, *args] = arguments["args"]
- env = [f"{k}={v}" for k, v in arguments.get("env", {}).items()]
+ # Per DAP spec, "env" contains additions/overrides to the
+ # default environment, not a full replacement. Merge with
+ # os.environ so the spawned process inherits PATH etc.
+ env_dict = os.environ | arguments.get("env", {})
+ env = [f"{k}={v}" for k, v in env_dict.items()]
self.reverse_process = self.spawn_helper(
exe, args, env, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
More information about the lldb-commits
mailing list