Fix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6
authorWalter Erquinigo <a20012251@gmail.com>
Mon, 25 Jan 2021 22:05:04 +0000 (14:05 -0800)
committerWalter Erquinigo <a20012251@gmail.com>
Mon, 25 Jan 2021 22:06:10 +0000 (14:06 -0800)
This fails on Windows because std::future<llvm::Error> fail to compile.
Now switching to SBError as a workaround.

Failed buildbot: http://lab.llvm.org:8011/#/builders/83/builds/3021

lldb/tools/lldb-vscode/RunInTerminal.cpp
lldb/tools/lldb-vscode/RunInTerminal.h
lldb/tools/lldb-vscode/lldb-vscode.cpp

index 0df54ba..4db2806 100644 (file)
@@ -128,9 +128,15 @@ RunInTerminalDebugAdapterCommChannel::RunInTerminalDebugAdapterCommChannel(
     StringRef comm_file)
     : m_io(comm_file, "runInTerminal launcher") {}
 
-std::future<Error> RunInTerminalDebugAdapterCommChannel::NotifyDidAttach() {
+// Can't use \a std::future<llvm::Error> because it doesn't compile on Windows
+std::future<lldb::SBError>
+RunInTerminalDebugAdapterCommChannel::NotifyDidAttach() {
   return std::async(std::launch::async, [&]() {
-    return m_io.SendJSON(RunInTerminalMessageDidAttach().ToJSON());
+    lldb::SBError error;
+    if (llvm::Error err =
+            m_io.SendJSON(RunInTerminalMessageDidAttach().ToJSON()))
+      error.SetErrorString(llvm::toString(std::move(err)).c_str());
+    return error;
   });
 }
 
index 41f045d..cdccdd6 100644 (file)
@@ -103,7 +103,7 @@ public:
   /// \return
   ///     A future indicated whether the runInTerminal launcher received the
   ///     message correctly or not.
-  std::future<llvm::Error> NotifyDidAttach();
+  std::future<lldb::SBError> NotifyDidAttach();
 
   /// Fetch the pid of the runInTerminal launcher.
   ///
index 07b63f2..c581b9b 100644 (file)
@@ -1490,7 +1490,7 @@ llvm::Error request_runInTerminal(const llvm::json::Object &launch_request) {
   // This will notify the runInTerminal launcher that we attached.
   // We have to make this async, as the function won't return until the launcher
   // resumes and reads the data.
-  std::future<llvm::Error> did_attach_message_success =
+  std::future<lldb::SBError> did_attach_message_success =
       comm_channel.NotifyDidAttach();
 
   // We just attached to the runInTerminal launcher, which was waiting to be
@@ -1509,7 +1509,11 @@ llvm::Error request_runInTerminal(const llvm::json::Object &launch_request) {
   // the async didAttach notification should have an error message, so we
   // return it. Otherwise, everything was a success.
   did_attach_message_success.wait();
-  return did_attach_message_success.get();
+  error = did_attach_message_success.get();
+  if (error.Success())
+    return llvm::Error::success();
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+                                 error.GetCString());
 }
 
 // "LaunchRequest": {