Implements stdout capturing (by Vlad Losev); fixes compiler error on NVCC (by Zhanyong Wan).

This commit is contained in:
zhanyong.wan
2010-01-27 22:27:30 +00:00
parent 27a65a9d67
commit fd6f2a8a4b
4 changed files with 138 additions and 62 deletions

View File

@@ -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);