| Index: runtime/bin/stdio_linux.cc
|
| diff --git a/runtime/bin/stdio_linux.cc b/runtime/bin/stdio_linux.cc
|
| index 8199f201d71735f71de14abae6ccdc6eefd51cb0..d3aab28ae319fcab00c11bbd184a95107e465966 100644
|
| --- a/runtime/bin/stdio_linux.cc
|
| +++ b/runtime/bin/stdio_linux.cc
|
| @@ -83,6 +83,21 @@ bool Stdin::SetLineMode(bool enabled) {
|
| }
|
|
|
|
|
| +static bool TermHasXTerm() {
|
| + const char* term = getenv("TERM");
|
| + if (term == NULL) {
|
| + return false;
|
| + }
|
| + return strstr(term, "xterm") != NULL;
|
| +}
|
| +
|
| +
|
| +bool Stdin::AnsiSupported(bool* supported) {
|
| + *supported = isatty(STDIN_FILENO) && TermHasXTerm();
|
| + return true;
|
| +}
|
| +
|
| +
|
| bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) {
|
| struct winsize w;
|
| int status = NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w));
|
| @@ -94,6 +109,12 @@ bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) {
|
| return false;
|
| }
|
|
|
| +
|
| +bool Stdout::AnsiSupported(intptr_t fd, bool* supported) {
|
| + *supported = isatty(fd) && TermHasXTerm();
|
| + return true;
|
| +}
|
| +
|
| } // namespace bin
|
| } // namespace dart
|
|
|
|
|