Make a way to set the result status for Python defined commands, and don't overwrite the status of the result if
the python command has set it.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159273 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index fd8efad..bc26c74 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -1214,6 +1214,8 @@
Error error;
+ result.SetStatus(eReturnStatusInvalid);
+
if (!scripter || scripter->RunScriptBasedCommand(m_function_name.c_str(),
raw_command_line,
m_synchro,
@@ -1224,7 +1226,16 @@
result.SetStatus(eReturnStatusFailed);
}
else
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ {
+ // Don't change the status if the command already set it...
+ if (result.GetStatus() == eReturnStatusInvalid)
+ {
+ if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ else
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ }
+ }
return result.Succeeded();
}