Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a9979ec authored by Josh Gao's avatar Josh Gao
Browse files

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
parent baa215ea
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -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;
}

+1 −0
Original line number Diff line number Diff line
@@ -124,4 +124,5 @@ void LinePrinter::Print(string to_print, LineType type) {

void LinePrinter::KeepInfoLine() {
  if (!have_blank_line_) Out("\n");
  have_blank_line_ = true;
}