Fix places that were writing directly to the debugger's output
handles to go through the appropriate channels instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131415 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index c3d4015..6c52890 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -851,12 +851,17 @@
         if (command_string == NULL)
             command_string = "";
         SBCommandReturnObject result;
-        result.SetImmediateOutputFile (m_debugger.GetOutputFileHandle());
-        result.SetImmediateErrorFile (m_debugger.GetErrorFileHandle());
         
-        // We've set the result to dump immediately.
+        // We don't want the result to bypass the OutWrite function in IOChannel, as this can result in odd
+        // output orderings and problems with the prompt.
         m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true);
 
+        if (result.GetOutputSize() > 0)
+            m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), NO_ASYNC);
+            
+        if (result.GetErrorSize() > 0)
+            m_io_channel_ap->OutWrite (result.GetError(), result.GetErrorSize(), NO_ASYNC);
+
         // We are done getting and running our command, we can now clear the
         // m_waiting_for_command so we can get another one.
         m_waiting_for_command = false;