diff options
author | Abseil Team <absl-team@google.com> | 2024-01-16 12:55:45 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-01-16 12:56:41 -0800 |
commit | f6f920d2ba09f3951af59045cd31c42e95bf127a (patch) | |
tree | a753df9186bd964d768a1197e533b9a70e7efdeb /googletest/src/gtest.cc | |
parent | cfe5076a8b99ce7979b0b5d328ff8a9199e04eef (diff) | |
download | googletest-f6f920d2ba09f3951af59045cd31c42e95bf127a.tar.gz |
Make posix::FileNo available under !GTEST_HAS_FILE_SYSTEM
This enables automatic color output without filesystem support, as that only requires testing to see if the output is a terminal.
Fixes: #4439
PiperOrigin-RevId: 598929397
Change-Id: Idca7490e6e090951a78cd1cdd710f41d756a68b4
Diffstat (limited to 'googletest/src/gtest.cc')
-rw-r--r-- | googletest/src/gtest.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 46212e74..8a19c50c 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3288,11 +3288,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) { va_start(args, fmt); static const bool in_color_mode = -#if GTEST_HAS_FILE_SYSTEM + // We don't condition this on GTEST_HAS_FILE_SYSTEM because we still need + // to be able to detect terminal I/O regardless. ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); -#else - false; -#endif // GTEST_HAS_FILE_SYSTEM const bool use_color = in_color_mode && (color != GTestColor::kDefault); |