Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3371,15 +3371,14 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
if (line.empty())
return;
}
bool echoed_command = false;
if (!is_interactive) {
// When using a non-interactive file handle (like when sourcing commands
// from a file) we need to echo the command out so we don't just see the
// command output and no command...
if (EchoCommandNonInteractive(line, io_handler.GetFlags())) {
io_handler.GetOutputStreamFileSP()->Lock()
<< io_handler.GetPrompt() << line << '\n';
echoed_command = true;
LockedStreamFile locked_stream =
io_handler.GetOutputStreamFileSP()->Lock();
locked_stream.Printf("%s%s\n", io_handler.GetPrompt(), line.c_str());
}
}

Expand All @@ -3399,21 +3398,10 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
lldb_private::CommandReturnObject result(m_debugger.GetUseColor());
HandleCommand(line.c_str(), eLazyBoolCalculate, result);

const bool print_result =
result.Succeeded() &&
io_handler.GetFlags().Test(eHandleCommandFlagPrintResult);
const bool print_error =
io_handler.GetFlags().Test(eHandleCommandFlagPrintErrors);

// Now emit the command output text from the command we just executed.
if (print_result || print_error) {
// If the command failed and we didn't echo it, echo it now so the user
// knows which command produced the error.
if (!echoed_command && !result.Succeeded() && print_error) {
io_handler.GetOutputStreamFileSP()->Lock()
<< io_handler.GetPrompt() << line << '\n';
}

// Now emit the command output text from the command we just executed
if ((result.Succeeded() &&
io_handler.GetFlags().Test(eHandleCommandFlagPrintResult)) ||
io_handler.GetFlags().Test(eHandleCommandFlagPrintErrors)) {
auto DefaultPrintCallback = [&](const CommandReturnObject &result) {
// Display any inline diagnostics first.
const bool inline_diagnostics = !result.GetImmediateErrorStream() &&
Expand Down
4 changes: 0 additions & 4 deletions lldb/test/Shell/Settings/Inputs/FailedCommand.in

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/test/Shell/Settings/TestEchoFailedCommands.test

This file was deleted.

Loading