From d61c10bc79322b5c51a6facf0de490b1dcf6a809 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 16 Jun 2011 16:27:19 +0000 Subject: Add 'batch_mode' to CommandInterpreter. Modify InputReaders to not write output (prompts, instructions,etc.) if the CommandInterpreter is in batch_mode. Also, finish updating InputReaders to write to the asynchronous stream, rather than using the Debugger's output file directly. llvm-svn: 133162 --- lldb/source/Commands/CommandObjectCommands.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lldb/source/Commands/CommandObjectCommands.cpp') diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index e8d4377..03fa8856 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -925,10 +925,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, size_t bytes_len) { CommandObjectCommandsAddRegex *add_regex_cmd = (CommandObjectCommandsAddRegex *) baton; + bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode(); switch (notification) { case eInputReaderActivate: + if (!batch_mode) { StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream (); out_stream->Printf("%s\n", "Enter regular expressions in the form 's///' and terminate with an empty line:"); @@ -955,9 +957,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, Error error (add_regex_cmd->AppendRegexSubstitution (bytes_strref)); if (error.Fail()) { - StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); - out_stream->Printf("error: %s\n", error.AsCString()); - out_stream->Flush(); + if (!batch_mode) + { + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); + out_stream->Printf("error: %s\n", error.AsCString()); + out_stream->Flush(); + } add_regex_cmd->InputReaderDidCancel (); reader.SetIsDone (true); } @@ -967,9 +972,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, case eInputReaderInterrupt: { reader.SetIsDone (true); - StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); - out_stream->PutCString("Regular expression command creations was cancelled.\n"); - out_stream->Flush(); + if (!batch_mode) + { + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); + out_stream->PutCString("Regular expression command creations was cancelled.\n"); + out_stream->Flush(); + } add_regex_cmd->InputReaderDidCancel (); } break; -- cgit v1.1