Fix various adb error reporting bugs.
`adb install` was writing success to stderr rather than stdout.
Server mismatch messages were going to stdout rather than stderr.
Error messages should consistently start with a lower case letter.
Also improve consistency of syntax error reporting.
Bug: https://issuetracker.google.com/37128706 (adb install success to stdout)
Bug: https://issuetracker.google.com/37140458 (server mismatch on stderr)
Bug: http://b/32413861 (consistency)
Test: ran tests
Change-Id: I0d6cb0c7482bec03483dacefd996644b7a28d273
diff --git a/adb/bugreport.cpp b/adb/bugreport.cpp
index 9dc9811..da2cfa2 100644
--- a/adb/bugreport.cpp
+++ b/adb/bugreport.cpp
@@ -137,7 +137,7 @@
SetSrcFile(&line[strlen(BUGZ_OK_PREFIX)]);
} else if (android::base::StartsWith(line, BUGZ_FAIL_PREFIX)) {
const char* error_message = &line[strlen(BUGZ_FAIL_PREFIX)];
- fprintf(stderr, "Device failed to take a zipped bugreport: %s\n", error_message);
+ fprintf(stderr, "adb: device failed to take a zipped bugreport: %s\n", error_message);
status_ = -1;
} else if (show_progress_ && android::base::StartsWith(line, BUGZ_PROGRESS_PREFIX)) {
// progress_line should have the following format:
@@ -195,7 +195,7 @@
};
int Bugreport::DoIt(TransportType transport_type, const char* serial, int argc, const char** argv) {
- if (argc > 2) return usage("usage: adb bugreport [PATH]");
+ if (argc > 2) return syntax_error("adb bugreport [PATH]");
// Gets bugreportz version.
std::string bugz_stdout, bugz_stderr;