diff options
| author | Josh Gao <jmgao@google.com> | 2018-11-08 13:33:18 -0800 |
|---|---|---|
| committer | Josh Gao <jmgao@google.com> | 2018-11-12 14:08:40 -0800 |
| commit | 68b5d0c3e3e3bb0bc594a1f1bb4427fdbac93f5e (patch) | |
| tree | 4b1a810813446eca6d8b0acddcc9aed46292b7a3 | |
| parent | cd85556151d843632264b7d76462bc7571f67ead (diff) | |
| download | system_core-68b5d0c3e3e3bb0bc594a1f1bb4427fdbac93f5e.tar.gz system_core-68b5d0c3e3e3bb0bc594a1f1bb4427fdbac93f5e.tar.bz2 system_core-68b5d0c3e3e3bb0bc594a1f1bb4427fdbac93f5e.zip | |
adb: flush stderr after logging on Windows.
Test: set ADB_TRACE=1 & adb.exe server nodaemon
Change-Id: Ibb109618be7eaae49461a306e34ff79451ec330e
| -rw-r--r-- | adb/adb_trace.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/adb/adb_trace.cpp b/adb/adb_trace.cpp index a8ec5fb12..a024a89bf 100644 --- a/adb/adb_trace.cpp +++ b/adb/adb_trace.cpp @@ -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. |
