adb: flush stderr after logging on Windows.

Test: set ADB_TRACE=1 & adb.exe server nodaemon
Change-Id: Ibb109618be7eaae49461a306e34ff79451ec330e
This commit is contained in:
Josh Gao 2018-11-08 13:33:18 -08:00
parent cd85556151
commit 68b5d0c3e3
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,11 @@ void AdbLogger(android::base::LogId id, android::base::LogSeverity severity,
const char* tag, const char* file, unsigned int line,
const char* message) {
android::base::StderrLogger(id, severity, tag, file, line, message);
#if defined(_WIN32)
// stderr can be buffered on Windows (and setvbuf doesn't seem to work), so explicitly flush.
fflush(stderr);
#endif
#if !ADB_HOST
// Only print logs of INFO or higher to logcat, so that `adb logcat` with adbd tracing on
// doesn't result in exponential logging.