[Lldb-commits] [lldb] [lldb-dap] Implement `runInTerminal` for Windows (PR #121269)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 10 09:53:15 PST 2025


================
@@ -24,41 +30,95 @@ using namespace llvm;
 
 namespace lldb_dap {
 
-FifoFile::FifoFile(StringRef path) : m_path(path) {}
-
+FifoFile::FifoFile(StringRef path)
+    : m_path(path), m_file(fopen(path.data(), "r+")) {
+  std::error_code EC;
+  if (m_file == nullptr) {
+    EC = std::error_code(errno, std::generic_category());
+    llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+                 << "\n";
+    std::terminate();
----------------
ashgti wrote:

Its a bit odd for this to fully terminate the running program if the allocation fails.

Can we adjust this to use either have a static `create` function that returns an `llvm::Expected<FifoFile>` or have an `open` method that returns an `llvm::Error` instead of terminating the running program.

https://github.com/llvm/llvm-project/pull/121269


More information about the lldb-commits mailing list