[Lldb-commits] [lldb] r373776 - [Host] Don't discard return value from RunShellCommand

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 4 12:37:46 PDT 2019


Author: jdevlieghere
Date: Fri Oct  4 12:37:46 2019
New Revision: 373776

URL: http://llvm.org/viewvc/llvm-project?rev=373776&view=rev
Log:
[Host] Don't discard return value from RunShellCommand

The recent change to expand arguments with the user's shell sometimes
caused a timeout and the error was not propagated.

Modified:
    lldb/trunk/source/Host/macosx/objcxx/Host.mm
    lldb/trunk/source/Host/windows/Host.cpp

Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=373776&r1=373775&r2=373776&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Fri Oct  4 12:37:46 2019
@@ -1366,9 +1366,14 @@ Status Host::ShellExpandArguments(Proces
     }
     bool run_in_default_shell = true;
     bool hide_stderr = true;
-    RunShellCommand(expand_command, cwd, &status, nullptr, &output,
-                    std::chrono::seconds(10), run_in_default_shell,
-                    hide_stderr);
+    Status e = RunShellCommand(expand_command, cwd, &status, nullptr, &output,
+                               std::chrono::seconds(10), run_in_default_shell,
+                               hide_stderr);
+
+    if (e.Fail()) {
+      error.SetErrorString(e.AsCString());
+      return error;
+    }
 
     if (status != 0) {
       error.SetErrorStringWithFormat("lldb-argdumper exited with error %d",

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=373776&r1=373775&r2=373776&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Fri Oct  4 12:37:46 2019
@@ -226,8 +226,14 @@ Status Host::ShellExpandArguments(Proces
     int status;
     std::string output;
     std::string command = expand_command.GetString();
-    RunShellCommand(command.c_str(), launch_info.GetWorkingDirectory(), &status,
-                    nullptr, &output, std::chrono::seconds(10));
+    Status e =
+        RunShellCommand(command.c_str(), launch_info.GetWorkingDirectory(),
+                        &status, nullptr, &output, std::chrono::seconds(10));
+
+    if (e.Fail()) {
+      error.SetErrorString(e.AsCString());
+      return error;
+    }
 
     if (status != 0) {
       error.SetErrorStringWithFormat("lldb-argdumper exited with error %d",




More information about the lldb-commits mailing list