console: only color outputs if stdout isa TTY
[nit.git] / lib / core / posix.nit
index 2969830..587e606 100644 (file)
@@ -111,3 +111,8 @@ extern class Group `{struct group*`}
                return ret;
        `}
 end
+
+redef class Int
+       # Does the file descriptor `self` refer to a terminal?
+       fun isatty: Bool `{ return isatty(self); `}
+end