mirror of
https://github.com/google/googletest.git
synced 2025-01-15 09:15:48 +08:00
Merge pull request #3866 from eidosmontreal:simplify_shouldusecolor
PiperOrigin-RevId: 454616721 Change-Id: I33b5671646ec027da48cc941baf84b4ddc722e07
This commit is contained in:
commit
b644b4fbbf
@ -1965,7 +1965,8 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
|
|||||||
}
|
}
|
||||||
inline char* StrDup(const char* src) { return strdup(src); }
|
inline char* StrDup(const char* src) { return strdup(src); }
|
||||||
#else // !__BORLANDC__
|
#else // !__BORLANDC__
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \
|
||||||
|
GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM)
|
||||||
inline int DoIsATTY(int /* fd */) { return 0; }
|
inline int DoIsATTY(int /* fd */) { return 0; }
|
||||||
#else
|
#else
|
||||||
inline int DoIsATTY(int fd) { return _isatty(fd); }
|
inline int DoIsATTY(int fd) { return _isatty(fd); }
|
||||||
|
@ -3278,14 +3278,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \
|
|
||||||
GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM)
|
|
||||||
const bool use_color = AlwaysFalse();
|
|
||||||
#else
|
|
||||||
static const bool in_color_mode =
|
static const bool in_color_mode =
|
||||||
ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
|
ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
|
||||||
const bool use_color = in_color_mode && (color != GTestColor::kDefault);
|
const bool use_color = in_color_mode && (color != GTestColor::kDefault);
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS
|
|
||||||
|
|
||||||
if (!use_color) {
|
if (!use_color) {
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user