[Lldb-commits] [lldb] [lldb] Have Host::RunShellCommand ret stderr & stdout seperately (PR #184548)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 4 11:07:15 PST 2026


================
@@ -1706,13 +1706,16 @@ class CommandObjectPlatformShell : public CommandObjectRaw {
     if (platform_sp) {
       FileSpec working_dir{};
       std::string output;
+      std::string error_output;
       int status = -1;
       int signo = -1;
-      error = (platform_sp->RunShellCommand(m_options.m_shell_interpreter, cmd,
-                                            working_dir, &status, &signo,
-                                            &output, m_options.m_timeout));
+      error = (platform_sp->RunShellCommand(
+          m_options.m_shell_interpreter, cmd, working_dir, &status, &signo,
+          &output, &error_output, m_options.m_timeout));
       if (!output.empty())
         result.GetOutputStream().PutCString(output);
+      if (!error_output.empty())
+        result.GetOutputStream().PutCString(error_output);
----------------
jimingham wrote:

It might be easier to understand this output if we made it clear what was error and what was stdout here?  It's a bit weird that you run the command and see:

output1
error1
output2
error2

and then run it in lldb and see:

output1
output2
error1
error2

But if we made it clear we were separating the two, like:

Command output:
output1
output2

Command error:

error1
error2

That would be clearer.



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


More information about the lldb-commits mailing list