adb: add missing newline when printing transfer rate.
Previously, we weren't printing a newline when reporting transfer
rates, so only the last transfer rate printed would be visible.
Bug: http://b/30667841
Change-Id: Id341147912d057673de4ad26a8f618f04a8c02f3
Test: inspected output manually
diff --git a/file_sync_client.cpp b/file_sync_client.cpp
index 454de41..12c7837 100644
--- a/file_sync_client.cpp
+++ b/file_sync_client.cpp
@@ -346,6 +346,18 @@
line_printer_.Print(s, LinePrinter::INFO);
}
+ void Println(const char* fmt, ...) __attribute__((__format__(ADB_FORMAT_ARCHETYPE, 2, 3))) {
+ std::string s;
+
+ va_list ap;
+ va_start(ap, fmt);
+ android::base::StringAppendV(&s, fmt, ap);
+ va_end(ap);
+
+ line_printer_.Print(s, LinePrinter::INFO);
+ line_printer_.KeepInfoLine();
+ }
+
void Error(const char* fmt, ...) __attribute__((__format__(ADB_FORMAT_ARCHETYPE, 2, 3))) {
std::string s = "adb: error: ";
@@ -711,9 +723,9 @@
}
}
- sc.Printf("%s: %d file%s pushed. %d file%s skipped.%s", rpath.c_str(),
- pushed, (pushed == 1) ? "" : "s", skipped,
- (skipped == 1) ? "" : "s", sc.TransferRate().c_str());
+ sc.Println("%s: %d file%s pushed. %d file%s skipped.%s", rpath.c_str(), pushed,
+ (pushed == 1) ? "" : "s", skipped, (skipped == 1) ? "" : "s",
+ sc.TransferRate().c_str());
return true;
}
@@ -920,9 +932,9 @@
}
}
- sc.Printf("%s: %d file%s pulled. %d file%s skipped.%s", rpath.c_str(),
- pulled, (pulled == 1) ? "" : "s", skipped,
- (skipped == 1) ? "" : "s", sc.TransferRate().c_str());
+ sc.Println("%s: %d file%s pulled. %d file%s skipped.%s", rpath.c_str(), pulled,
+ (pulled == 1) ? "" : "s", skipped, (skipped == 1) ? "" : "s",
+ sc.TransferRate().c_str());
return true;
}
diff --git a/line_printer.cpp b/line_printer.cpp
index 4ec8979..64d10b6 100644
--- a/line_printer.cpp
+++ b/line_printer.cpp
@@ -124,4 +124,5 @@
void LinePrinter::KeepInfoLine() {
if (!have_blank_line_) Out("\n");
+ have_blank_line_ = true;
}