The --gtest_color flag should take a priority.
This along with commitc1ef5eb034
should get back to the initial behavior prior to the change in commit83b6379783
. Fixes: 111396376 Test: `adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=yes` shows colored output. Test: `adb shell -t /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=no` doesn't add color escapes. Change-Id: I88530e8b264cd0c259c16b09bdf867cdd2e88224
This commit is contained in:
parent
9842db42e9
commit
afacaaba8c
1 changed files with 5 additions and 5 deletions
|
@ -79,11 +79,6 @@ static constexpr const char* COLOR_GREEN = "\033[0;32m";
|
||||||
static constexpr const char* COLOR_YELLOW = "\033[0;33m";
|
static constexpr const char* COLOR_YELLOW = "\033[0;33m";
|
||||||
|
|
||||||
static bool ShouldUseColor() {
|
static bool ShouldUseColor() {
|
||||||
bool stdout_is_tty = isatty(STDOUT_FILENO) != 0;
|
|
||||||
if (!stdout_is_tty) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& gtest_color = ::testing::GTEST_FLAG(color);
|
const auto& gtest_color = ::testing::GTEST_FLAG(color);
|
||||||
if (gtest_color == "yes" || gtest_color == "true" || gtest_color == "t") {
|
if (gtest_color == "yes" || gtest_color == "true" || gtest_color == "t") {
|
||||||
return true;
|
return true;
|
||||||
|
@ -92,6 +87,11 @@ static bool ShouldUseColor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool stdout_is_tty = isatty(STDOUT_FILENO) != 0;
|
||||||
|
if (!stdout_is_tty) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const char* const term = getenv("COLORTERM");
|
const char* const term = getenv("COLORTERM");
|
||||||
return term != nullptr && term[0] != 0;
|
return term != nullptr && term[0] != 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue