[Console] Add IS_TTY to force terminal coloring output (#3021)

This commit is contained in:
Chris Miles 2023-03-04 17:01:39 -06:00 committed by GitHub
parent 2a6cf8c8e7
commit e3f9b396ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,8 @@
#include <cstring>
#include <iostream>
inline bool g_is_forced_tty = std::getenv("IS_TTY");
namespace rang {
/* For better compability with most of terminals do not use any style settings
@ -220,6 +222,10 @@ inline bool isMsysPty(int fd) noexcept
inline bool isTerminal(const std::streambuf *osbuf) noexcept
{
if (g_is_forced_tty) {
return g_is_forced_tty;
}
using std::cerr;
using std::clog;
using std::cout;