[lldb] Add missing calls to SetStatus in CommandObjectPlatform (#197548)
Add missing calls to CommandReturnObject::SetStatus in
CommandObjectPlatform. I replaced some calls to AppendMessageWithFormatv
with AppendErrorWithFormatv because the latter implicitly sets the
status.
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 52b571a..82e3448 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -394,6 +394,7 @@
if (m_option_working_dir.GetOptionValue().OptionWasSet())
platform_sp->SetWorkingDirectory(
m_option_working_dir.GetOptionValue().GetCurrentValue());
+ result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
result.AppendError("no platform is currently selected");
}
@@ -833,8 +834,8 @@
remote_file_path, local_file_path);
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
- result.AppendMessageWithFormatv("get-file failed: {0}",
- error.AsCString());
+ result.AppendErrorWithFormatv("get-file failed: {0}",
+ error.AsCString());
}
} else {
result.AppendError("no platform currently selected\n");
@@ -879,9 +880,8 @@
remote_file_path.c_str(), size);
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
- result.AppendMessageWithFormatv(
- "Error getting file size of {0} (remote)",
- remote_file_path.c_str());
+ result.AppendErrorWithFormatv("failed to get file size of {0} (remote)",
+ remote_file_path.c_str());
}
} else {
result.AppendError("no platform currently selected\n");
@@ -1152,6 +1152,7 @@
if (rebroadcast_first_stop) {
assert(first_stop_event_sp);
process_sp->BroadcastEvent(first_stop_event_sp);
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
return;
}
@@ -1184,6 +1185,8 @@
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return;
}
+ if (result.GetStatus() != eReturnStatusFailed)
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
result.AppendError("'platform process launch' uses the current target "
"file and arguments, or the executable and its "
@@ -1503,6 +1506,8 @@
ostrm.EOL();
}
}
+ if (result.GetStatus() != eReturnStatusFailed)
+ result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
// Not connected...
result.AppendErrorWithFormatv("not connected to '{0}'",