From b6918c7c433054ac4352d5f7746f7c2bf2971083 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 19 May 2015 17:02:16 -0700 Subject: Log update outputs in order Although stdout and stderr are both redirected to log file with no buffering, we are seeing some outputs are mixed in random order. This is because ui_print commands from the updater are passed to the recovery binary via a pipe, which may interleave with other outputs that go to stderr directly. In recovery, adding ui::PrintOnScreenOnly() function to handle ui_print command, which skips printing to stdout. Meanwhile, updater prints the contents to stderr in addition to piping them to recovery. Change-Id: Idda93ea940d2e23a0276bb8ead4aa70a3cb97700 --- verifier_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'verifier_test.cpp') diff --git a/verifier_test.cpp b/verifier_test.cpp index 82546edce..21633dc20 100644 --- a/verifier_test.cpp +++ b/verifier_test.cpp @@ -141,6 +141,12 @@ class FakeUI : public RecoveryUI { vfprintf(stderr, fmt, ap); va_end(ap); } + void PrintOnScreenOnly(const char* fmt, ...) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + } void ShowFile(const char*) { } void StartMenu(const char* const * headers, const char* const * items, -- cgit v1.2.3