Make sure IsATTY does not clobber errno.
Make sure IsATTY does not clobber errno.

Exposition of the problem:
> cat main.cpp

TEST(errnoTest, errnoTest)
{
    ASSERT_EQ(errno, 0);
}

int main(int argc, char** argv)
{
    ::testing::InitGoogleTest(&argc, argv);

    return RUN_ALL_TESTS();
}

Compiled with gcc 10 like this:
> g++ -pthread -o runtest main.cpp -Wl,-Bstatic -lgtest -Wl,-Bdynamic

Before patch:
>  ./runtest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from errnoTest
[ RUN      ] errnoTest.errnoTest
[       OK ] errnoTest.errnoTest (0 ms)
[----------] 1 test from errnoTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.

(output is colored, I run this inside an interactive terminal).

> ./runtest | cat
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from errnoTest
[ RUN      ] errnoTest.errnoTest
main.cpp:5: Failure
Expected equality of these values:
  (*__errno_location ())
    Which is: 25
  0
[  FAILED  ] errnoTest.errnoTest (0 ms)
[----------] 1 test from errnoTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] errnoTest.errnoTest

 1 FAILED TEST

(output is not colored, since IsTTY return false, because of the pipe,
however it also clobbered errno for the tests).

After the patch, both cases are working fine:
> ./runtest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from errnoTest
[ RUN      ] errnoTest.errnoTest
[       OK ] errnoTest.errnoTest (0 ms)
[----------] 1 test from errnoTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.

> ./runtest | cat
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from errnoTest
[ RUN      ] errnoTest.errnoTest
[       OK ] errnoTest.errnoTest (0 ms)
[----------] 1 test from errnoTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.

google/googletest,google/googletest,gianricardo/googletest,empiredan/googletest,google/googletest,antidotcb/googletest,gianricardo/googletest,empiredan/googletest,empiredan/googletest,antidotcb/googletest,gianricardo/googletest,antidotcb/googletest,google/googletest,antidotcb/googletest