adb: create unix_isatty() function.
Our Windows code has several different ways it checks whether an FD is
a console or not, some of which aren't exactly correct as they may
treat character devices (e.g. NUL) as consoles.
This CL disallows using the builtin isatty() function and provides
unix_isatty() instead which correctly checks these corner cases.
Change-Id: I6d551c745dae691c7eb3446b585265d62c1e62fa
diff --git a/line_printer.cpp b/line_printer.cpp
index 81b3f0a..aa332f7 100644
--- a/line_printer.cpp
+++ b/line_printer.cpp
@@ -46,7 +46,7 @@
LinePrinter::LinePrinter() : have_blank_line_(true), console_locked_(false) {
#ifndef _WIN32
const char* term = getenv("TERM");
- smart_terminal_ = isatty(1) && term && string(term) != "dumb";
+ smart_terminal_ = unix_isatty(1) && term && string(term) != "dumb";
#else
// Disable output buffer. It'd be nice to use line buffering but
// MSDN says: "For some systems, [_IOLBF] provides line