Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static Result<void> ListenEventsAndProxy(int events_fd,
// recoverable.
if (!received_event.ok()) {
LOG(ERROR) << "Failed reading kernel log event: "
<< received_event.error().FormatForEnv();
<< received_event.error();
continue;
}
if (!(*received_event)) {
Expand Down Expand Up @@ -248,7 +248,7 @@ int main(int argc, char* argv[]) {

auto result = cuttlefish::socket_proxy::Main();
if (!result.ok()) {
LOG(FATAL) << "Failed to proxy: " << result.error().FormatForEnv();
LOG(FATAL) << "Failed to proxy: " << result.error();
}

return 0;
Expand Down
5 changes: 2 additions & 3 deletions base/cvd/cuttlefish/common/libs/utils/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ std::string ExtractArchiveToMemory(const std::string& archive_filepath,

if (!stdout_str.ok()) {
LOG(ERROR) << "Could not extract \"" << archive_member << "\" from \""
<< archive_filepath
<< "\" to memory: " << stdout_str.error().FormatForEnv();
<< archive_filepath << "\" to memory: " << stdout_str.error();
return "";
}
return *stdout_str;
Expand All @@ -159,7 +158,7 @@ std::vector<std::string> ArchiveContents(const std::string& archive) {
return android::base::Split(*bsdtar_output, "\n");
} else {
LOG(ERROR) << "`bsdtar -tf '" << archive
<< "'`failed: " << bsdtar_output.error().FormatForEnv();
<< "'`failed: " << bsdtar_output.error();
return {};
}
}
Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/common/libs/utils/files_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FilesTests : public ::testing::Test {
void SetUp() override {
Result<void> result = CreateTestDirs();
if (!result.ok()) {
FAIL() << result.error().FormatForEnv();
FAIL() << result.error();
}
}

Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/common/libs/utils/subprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ Subprocess Command::Start(SubprocessOptions options) const {

if (!prerequisiteResult.ok()) {
LOG(ERROR) << "Failed to check prerequisites: "
<< prerequisiteResult.error().FormatForEnv();
<< prerequisiteResult.error();
return Subprocess(-1, {});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,6 @@ int main(int argc, char** argv) {
if (res.ok()) {
return *res;
}
LOG(ERROR) << "assemble_cvd failed: \n" << res.error().FormatForEnv();
LOG(ERROR) << "assemble_cvd failed: \n" << res.error();
abort();
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Result<void> PrepareBootEnvImage(
"Unable to delete the old env image");
LOG(DEBUG) << "Updated bootloader environment image.";
} else if (Result<void> rs = RemoveFile(tmp_boot_env_image_path); !rs.ok()) {
LOG(WARNING) << rs.error().FormatForEnv();
LOG(WARNING) << rs.error();
}

return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool DeleteTmpFileIfNotChanged(const std::string& tmp_file, const std::string& c
} else {
LOG(DEBUG) << "Didn't update " << current_file;
if (Result<void> res = RemoveFile(tmp_file); !res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}
}

Expand Down Expand Up @@ -176,7 +176,7 @@ void UnpackRamdisk(const std::string& original_ramdisk_path,
<< original_ramdisk_path << "'.";
}
const auto ret = EnsureDirectoryExists(ramdisk_stage_dir);
CHECK(ret.ok()) << ret.error().FormatForEnv();
CHECK(ret.ok()) << ret.error();

SharedFD input = SharedFD::Open(original_ramdisk_path + kCpioExt, O_RDONLY);
int cpio_status;
Expand Down Expand Up @@ -245,7 +245,7 @@ bool UnpackVendorBootImageIfNotUnpacked(

Result<std::vector<std::string>> unpack_files = DirectoryContents(unpack_dir);
if (!unpack_files.ok()) {
LOG(ERROR) << "No unpacked files: " << unpack_files.error().FormatForEnv();
LOG(ERROR) << "No unpacked files: " << unpack_files.error();
return false;
}
for (const std::string& unpacked : *unpack_files) {
Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Result<void> CleanPriorFiles(const std::vector<std::string>& paths,
"Instance directory files in use. Try `cvd reset`? Observed PIDs: {}",
fmt::join(pids, ", "));
} else {
LOG(ERROR) << "Failed to run `lsof`: " << lsof_out.error().FormatForEnv();
LOG(ERROR) << "Failed to run `lsof`: " << lsof_out.error();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Result<void> CreateDynamicDiskFiles(
LOG(DEBUG) << "Found image zip: " << *img_zip;
} else {
LOG(DEBUG) << "Error accessing '-img-*.zip', expected for a local build.";
LOG(DEBUG) << img_zip.error().FormatForEnv();
LOG(DEBUG) << img_zip.error();
}

std::optional<ChromeOsStateImage> chrome_os_state =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ GetGraphicsAvailabilityWithSubprocessCheck() {
if (!graphics_detector_stdout.ok()) {
LOG(ERROR)
<< "Failed to run graphics detector, assuming no availability: \n"
<< graphics_detector_stdout.error().FormatForEnv();
<< graphics_detector_stdout.error();
return {};
}
LOG(DEBUG) << *graphics_detector_stdout;
Expand All @@ -545,7 +545,7 @@ GetGraphicsAvailabilityWithSubprocessCheck() {
if (!graphics_availability_content_result.ok()) {
LOG(ERROR) << "Failed to read graphics availability from file "
<< graphics_availability_file.path << ":"
<< graphics_availability_content_result.error().FormatForEnv()
<< graphics_availability_content_result.error()
<< ". Assuming no availability.";
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ bool MoveIfChanged(const std::string& src, const std::string& dst) {
}
const auto ret = RenameFile(src, dst);
if (!ret.ok()) {
LOG(ERROR) << ret.error().FormatForEnv();
LOG(ERROR) << ret.error();
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Status ResultToStatus(Result<void> res) {
if (res.ok()) {
return Status::OK;
} else {
LOG(ERROR) << "RPC failed: " << res.error().FormatForEnv();
LOG(ERROR) << "RPC failed: " << res.error();
return Status(StatusCode::INTERNAL,
res.error().FormatForEnv(/* color = */ false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ Result<void> CvdBugreportCommandHandler::Handle(const CommandRequest& request) {

auto result = AddFetchLogIfPresent(instance_group, output_file);
if (!result.ok()) {
LOG(ERROR) << "Failed to add fetch log to bugreport: "
<< result.error().FormatForEnv();
LOG(ERROR) << "Failed to add fetch log to bugreport: " << result.error();
}

return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Result<void> CvdCreateCommandHandler::Handle(const CommandRequest& request) {
auto symlink_res = CreateSymlinks(group);
if (!symlink_res.ok()) {
LOG(ERROR) << "Failed to create symlinks for default group: "
<< symlink_res.error().FormatForEnv();
<< symlink_res.error();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class CvdHelpHandler : public CvdCommandHandler {
CommandRequest GetLookupRequest(const std::string& arg) {
auto result = CommandRequestBuilder().AddArguments({"cvd", arg}).Build();
CHECK(result.ok()) << "Failed to build cvd command request"
<< result.error().FormatForEnv();
<< result.error();
return result.value();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RemoveCvdCommandHandler : public CvdCommandHandler {

auto stop_res = StopGroup(group, request);
if (!stop_res.ok()) {
LOG(ERROR) << stop_res.error().FormatForEnv();
LOG(ERROR) << stop_res.error();
LOG(ERROR) << "Unable to stop devices first, run `cvd reset` to forcibly "
"kill any remaining device processes.";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Result<void> StartStopRecording(const RecordingFlags& flags,
if (!result.ok()) {
LOG(ERROR) << "Failed to " << flags.subcmd
<< " screen recording for instance " << instance.name() << ": "
<< result.error().FormatForEnv();
<< result.error();
some_failed = true;
}
}
Expand All @@ -121,7 +121,7 @@ Result<void> ListRecordings(const LocalInstanceGroup& group,
recordings = std::move(*result);
} else {
LOG(ERROR) << "Failed to list screen recording for instance "
<< instance.name() << ": " << result.error().FormatForEnv();
<< instance.name() << ": " << result.error();
some_failed = true;
}
for (const std::string& recording : recordings) {
Expand Down
10 changes: 4 additions & 6 deletions base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,15 @@ Result<void> CvdStartCommandHandler::Handle(const CommandRequest& request) {
LOG(WARNING) << strsignal(signal) << " signal received, cleanning up";
auto interrupt_res = subprocess_waiter_.Interrupt();
if (!interrupt_res.ok()) {
LOG(ERROR) << "Failed to stop subprocesses: "
<< interrupt_res.error().FormatForEnv();
LOG(ERROR) << "Failed to stop subprocesses: " << interrupt_res.error();
LOG(ERROR) << "Devices may still be executing in the background, run "
"`cvd reset` to ensure a clean state";
}

group.SetAllStates(cvd::INSTANCE_STATE_CANCELLED);
auto update_res = instance_manager_.UpdateInstanceGroup(group);
if (!update_res.ok()) {
LOG(ERROR) << "Failed to update group status: "
<< update_res.error().FormatForEnv();
LOG(ERROR) << "Failed to update group status: " << update_res.error();
}
// It's technically possible for the group's state to be set to
// "running" before abort has a chance to run, but that can only happen
Expand Down Expand Up @@ -528,7 +526,7 @@ Result<void> CvdStartCommandHandler::LaunchDevice(
if (!conn_res.ok()) {
LOG(ERROR) << "Failed to pre-register devices with operator, group "
"information won't show in the UI: "
<< conn_res.error().FormatForEnv();
<< conn_res.error();
}
LOG(INFO) << "launch command: " << launch_command;

Expand Down Expand Up @@ -565,7 +563,7 @@ Result<void> CvdStartCommandHandler::LaunchDeviceInterruptible(
auto symlink_config_res = SymlinkPreviousConfig(group.HomeDir());
if (!symlink_config_res.ok()) {
LOG(ERROR) << "Failed to symlink the config file at system wide home: "
<< symlink_config_res.error().FormatForEnv();
<< symlink_config_res.error();
}
Result<void> start_res =
LaunchDevice(std::move(command), group, envs, request);
Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Result<void> SubstituteWithFlag(
}
Result<void> symlink_res = Symlink(path, to_substitute);
if (!symlink_res.ok()) {
LOG(ERROR) << symlink_res.error().FormatForEnv();
LOG(ERROR) << symlink_res.error();
substitution_error = true;
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ std::vector<LocalInstanceGroup> InstanceDatabase::FindGroups(
}
auto group_res = LocalInstanceGroup::Create(group);
CHECK(group_res.ok()) << "Instance group from database fails validation: "
<< group_res.error().FormatForEnv();
<< group_res.error();
ret.push_back(*group_res);
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ Result<bool> InstanceManager::RemoveInstanceGroup(LocalInstanceGroup group) {
continue;
}
if (auto res = lock_manager_.RemoveLockFile(instance.id()); !res.ok()) {
LOG(ERROR) << "Failed to remove instance id lock: "
<< res.error().FormatForEnv();
LOG(ERROR) << "Failed to remove instance id lock: " << res.error();
}
}
CF_EXPECT(RemoveGroupDirectory(group));
Expand Down Expand Up @@ -244,7 +243,7 @@ Result<void> InstanceManager::Clear() {
auto stop_result = StopInstanceGroup(group, std::chrono::seconds(5),
InstanceDirActionOnStop::Clear);
if (!stop_result.ok()) {
LOG(ERROR) << stop_result.error().FormatForEnv();
LOG(ERROR) << stop_result.error();
}
}
for (auto instance : group.Instances()) {
Expand All @@ -254,16 +253,16 @@ Result<void> InstanceManager::Clear() {
auto res = lock_manager_.RemoveLockFile(instance.id());
if (!res.ok()) {
LOG(ERROR) << "Failed to remove lock file for instance: "
<< res.error().FormatForEnv();
<< res.error();
}
}
std::string runtime_link = group.HomeDir() + "/cuttlefish_runtime";
if (Result<void> res = RemoveFile(runtime_link);!res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}
std::string config_link = group.HomeDir() + config_json_name;
if (Result<void> res = RemoveFile(config_link);!res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}
// TODO: b/471069557 - diagnose unused
Result<void> unused = RemoveGroupDirectory(group);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static Result<std::string> StopCvdPath(const RunCvdProcInfo& info) {
if (result.ok()) {
return *result;
}
LOG(ERROR) << result.error().FormatForEnv();
LOG(ERROR) << result.error();
} else {
LOG(ERROR) << "run_cvd host tool directory was not able to be guessed.";
}
Expand Down
14 changes: 7 additions & 7 deletions base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Result<void> RunStopCvdAll(bool clear_runtime_dirs) {
.clear_runtime_dirs = clear_runtime_dirs,
});
if (!stop_cvd_result.ok()) {
LOG(ERROR) << stop_cvd_result.error().FormatForEnv();
LOG(ERROR) << stop_cvd_result.error();
continue;
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ Result<void> DeleteLockFile(const GroupProcInfo& group_info) {
} else {
all_success = false;
LOG(ERROR) << "Failed to remove the lock file '" << lock_file_path
<< "': " << res.error().FormatForEnv();
<< "': " << res.error();
}
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ Result<void> KillAllRunCvds() {
<< " run_cvd processes still remain, will stop forcefully";
for (pid_t group_pid : run_cvd_pids) {
if (Result<void> result = SendSignal(group_pid); !result.ok()) {
LOG(ERROR) << result.error().FormatForEnv();
LOG(ERROR) << result.error();
}
}
return {};
Expand All @@ -212,7 +212,7 @@ Result<void> DeleteAllOwnedInstanceLocks() {
continue;
}
if (Result<void> res = RemoveFile(lock_file_path); !res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}
}
return {};
Expand All @@ -222,15 +222,15 @@ Result<void> DeleteAllOwnedInstanceLocks() {

Result<void> KillAllCuttlefishInstances(bool clear_runtime_dirs) {
if (Result<void> res = RunStopCvdAll(clear_runtime_dirs); !res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}

if (Result<void> res = KillAllRunCvds(); !res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}

if (Result<void> res = DeleteAllOwnedInstanceLocks(); !res.ok()) {
LOG(ERROR) << res.error().FormatForEnv();
LOG(ERROR) << res.error();
}

return {};
Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/cvd_env/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ Result<void> CvdEnvMain(int argc, char** argv) {

int main(int argc, char** argv) {
const auto& ret = cuttlefish::CvdEnvMain(argc, argv);
CHECK(ret.ok()) << ret.error().FormatForEnv();
CHECK(ret.ok()) << ret.error();
return 0;
}
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/cvdalloc/cvdalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Result<int> CvdallocMain(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
auto res = cuttlefish::CvdallocMain(argc, argv);
if (!res.ok()) {
LOG(ERROR) << "cvdalloc failed: \n" << res.error().FormatForEnv();
LOG(ERROR) << "cvdalloc failed: \n" << res.error();
abort();
}

Expand Down
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/defaults/defaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Result<int> DefaultsMain(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
auto res = cuttlefish::DefaultsMain(argc, argv);
if (!res.ok()) {
LOG(ERROR) << "defaults failed: \n" << res.error().FormatForEnv();
LOG(ERROR) << "defaults failed: \n" << res.error();
abort();
}

Expand Down
Loading
Loading