Moved some functions to DumpstateUtil.h.
dumpstate_board() is been refactored into a HIDL interface, and the HIDL
implementations will need help functions to dump files and run commands into
a file descriptor.
BUG: 31982882
Test: dumpstate_test passes
Test: manual verification
Change-Id: I7a32f0ac236dae34fd85abe47bed0e52a34c5f36
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index ea70fe5..6348579 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -90,7 +90,7 @@
return ds.RunCommand(title, fullCommand, options);
}
static void RunDumpsys(const std::string& title, const std::vector<std::string>& dumpsysArgs,
- const CommandOptions& options = CommandOptions::DEFAULT_DUMPSYS,
+ const CommandOptions& options = Dumpstate::DEFAULT_DUMPSYS,
long dumpsysTimeout = 0) {
return ds.RunDumpsys(title, dumpsysArgs, options, dumpsysTimeout);
}
@@ -680,7 +680,8 @@
printf("Network: %s\n", network.c_str());
printf("Kernel: ");
- JustDumpFile("", "/proc/version");
+ fflush(stdout);
+ DumpFileToFd(STDOUT_FILENO, "/proc/version");
printf("Command line: %s\n", strtok(cmdline_buf, "\n"));
printf("Bugreport format version: %s\n", version_.c_str());
printf("Dumpstate info: id=%d pid=%d dry_run=%d args=%s extra_options=%s\n", id_, pid_,