Author: Ebuka Ezike
Date: 2026-08-06T11:42:16+01:00
New Revision: dcf0f2facf48baa24b84ad92a348a747b367bd8a

URL: 
https://github.com/llvm/llvm-project/commit/dcf0f2facf48baa24b84ad92a348a747b367bd8a
DIFF: 
https://github.com/llvm/llvm-project/commit/dcf0f2facf48baa24b84ad92a348a747b367bd8a.diff

LOG: [lldb-dap] Merge parent and user defined env when spawning server. 
(#213679)

The DAP server was spawned using only the user defined `options.env`,
which dropped the parent process's environment (e.g. PATH). Merge the
two, giving user-defined values priority on conflicts.

Fixes #159498

Added: 
    

Modified: 
    lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts 
b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
index deacdea145a41..7ee12d66b49d1 100644
--- a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
+++ b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
@@ -59,8 +59,14 @@ export class LLDBDapServer implements vscode.Disposable {
       return this.serverInfo;
     }
 
+    // Merge the parent env with the user defined env (user defined takes 
priority).
+    const dapSpawnOptions: child_process.SpawnOptionsWithoutStdio = {
+      ...options,
+      env: { ...process.env, ...options?.env },
+    };
+
     this.serverInfo = new Promise((resolve, reject) => {
-      const process = child_process.spawn(dapPath, dapArgs, options);
+      const process = child_process.spawn(dapPath, dapArgs, dapSpawnOptions);
       process.on("error", (error) => {
         reject(error);
         this.cleanUp(process);


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to