- Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting
a Stream, and then added GetOutputData & GetErrorData to get the accumulated data.
- Added a StreamTee that will tee output to two provided lldb::StreamSP's.
- Made the CommandObjectReturn use this so you can Tee the results immediately to
the debuggers output file, as well as saving up the results to return when the command
is done executing.
- HandleCommands now uses this so that if you have a set of commands that continue the target
you will see the commands come out as they are processed.
- The Driver now uses this to output the command results as you go, which makes the interface
more reactive seeming.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126015 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 3cf542f..04e69e4 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -30,6 +30,7 @@
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBListener.h"
 #include "lldb/API/SBSourceManager.h"
+#include "lldb/API/SBStream.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
 #include "lldb/API/SBProcess.h"
@@ -894,11 +895,12 @@
         if (command_string == NULL)
             command_string = "";
         SBCommandReturnObject result;
-        if (m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true) != lldb::eReturnStatusQuit)
-        {
-            m_io_channel_ap->ErrWrite (result.GetError(), result.GetErrorSize());
-            m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize());
-        }
+        result.SetImmediateOutputFile (m_debugger.GetOutputFileHandle());
+        result.SetImmediateErrorFile (m_debugger.GetErrorFileHandle());
+        
+        // We've set the result to dump immediately.
+        m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true);
+
         // 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;