[Lldb-commits] [lldb] [lldb-dap] extend env when testing reverse request (PR #193743)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 23 06:39:28 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/193743.diff
1 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+5-1)
``````````diff
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..f816b19447f8c 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 = [f"{k}={v}" for k, v in os.environ]
+ env += [f"{k}={v}" for k, v in arguments.get("env", {}).items()]
self.reverse_process = self.spawn_helper(
exe, args, env, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
``````````
</details>
https://github.com/llvm/llvm-project/pull/193743
More information about the lldb-commits
mailing list