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

Commit 68b5d0c3 authored by Josh Gao's avatar Josh Gao
Browse files

adb: flush stderr after logging on Windows.

Test: set ADB_TRACE=1 & adb.exe server nodaemon
Change-Id: Ibb109618be7eaae49461a306e34ff79451ec330e
parent cd855561
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -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* tag, const char* file, unsigned int line,
               const char* message) {
               const char* message) {
    android::base::StderrLogger(id, severity, tag, file, line, 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
#if !ADB_HOST
    // Only print logs of INFO or higher to logcat, so that `adb logcat` with adbd tracing on
    // Only print logs of INFO or higher to logcat, so that `adb logcat` with adbd tracing on
    // doesn't result in exponential logging.
    // doesn't result in exponential logging.