llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

This patch runs the `lldb-dap.exe --check-python` command before attempting to 
start lldb-dap in VSCode.

If the command fails, the extension will print an error and prevent lldb-dap 
from starting.

---
Full diff: https://github.com/llvm/llvm-project/pull/181124.diff


1 Files Affected:

- (modified) lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts (+10) 


``````````diff
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..53eaac92d1286 100644
--- a/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
+++ b/lldb/tools/lldb-dap/extension/src/lldb-dap-server.ts
@@ -2,6 +2,7 @@ import { FSWatcher, watch as chokidarWatch } from "chokidar";
 import * as child_process from "node:child_process";
 import { isDeepStrictEqual } from "util";
 import * as vscode from "vscode";
+import * as os from "os";
 
 /**
  * Represents a running lldb-dap process that is accepting connections (i.e. 
in "server mode").
@@ -60,6 +61,15 @@ export class LLDBDapServer implements vscode.Disposable {
     }
 
     this.serverInfo = new Promise((resolve, reject) => {
+      if (os.platform() === "win32") {
+        const pythonCheckProcess = child_process.spawnSync(dapPath, 
["--check-python"]);
+        if (pythonCheckProcess.stderr) {
+          vscode.window.showErrorMessage(
+            `Python is not installed correctly. Please install it to use 
lldb-dap.\n${pythonCheckProcess.stderr}`
+          );
+          return;
+        }
+      }
       const process = child_process.spawn(dapPath, dapArgs, options);
       process.on("error", (error) => {
         reject(error);

``````````

</details>


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

Reply via email to