aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtest.cc')
-rw-r--r--src/gtest.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index 11ce571b..f5de645b 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -2634,6 +2634,9 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
SetConsoleTextAttribute(stdout_handle,
GetColorAttribute(color) | FOREGROUND_INTENSITY);
vprintf(fmt, args);
+ // Unless we flush stream buffers now the next SetConsoleTextAttribute
+ // call can reset the color before the output reaches the console.
+ fflush(stdout);
// Restores the text color.
SetConsoleTextAttribute(stdout_handle, old_color_attrs);