diff options
author | Josh Gao <jmgao@google.com> | 2016-08-04 11:43:00 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2016-08-04 14:56:53 -0700 |
commit | 1a9979ec1ee913157a0e8e570ca93feacf58634e (patch) | |
tree | 4f7396b5cac508d39fada2df7744a5ba2cde80f2 /adb/file_sync_client.cpp | |
parent | baa215ea59842f0f94880b1a59830a557954588a (diff) |
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
Diffstat (limited to 'adb/file_sync_client.cpp')
-rw-r--r-- | adb/file_sync_client.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index 454de41be0..12c7837876 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -346,6 +346,18 @@ class SyncConnection { 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 @@ static bool copy_local_dir_remote(SyncConnection& sc, std::string lpath, } } - 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 @@ static bool copy_remote_dir_local(SyncConnection& sc, std::string rpath, } } - 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; } |