fix isatty for macOS and libc (#523)

master
Snorre 2017-10-03 15:33:30 +02:00 committed by Andrew Kelley
parent 3af35fc1df
commit 522b431057
2 changed files with 3 additions and 3 deletions

View File

@ -181,7 +181,7 @@ pub const OutStream = struct {
pub fn isTty(self: &OutStream) -> %bool { pub fn isTty(self: &OutStream) -> %bool {
if (is_posix) { if (is_posix) {
if (builtin.link_libc) { if (builtin.link_libc) {
return c.isatty(self.fd) == 0; return c.isatty(self.fd) != 0;
} else { } else {
return system.isatty(self.fd); return system.isatty(self.fd);
} }
@ -435,7 +435,7 @@ pub const InStream = struct {
pub fn isTty(self: &InStream) -> %bool { pub fn isTty(self: &InStream) -> %bool {
if (is_posix) { if (is_posix) {
if (builtin.link_libc) { if (builtin.link_libc) {
return c.isatty(self.fd) == 0; return c.isatty(self.fd) != 0;
} else { } else {
return system.isatty(self.fd); return system.isatty(self.fd);
} }

View File

@ -125,7 +125,7 @@ pub fn exit(code: i32) -> noreturn {
} }
pub fn isatty(fd: i32) -> bool { pub fn isatty(fd: i32) -> bool {
c.isatty(fd) == 0 c.isatty(fd) != 0
} }
pub fn fstat(fd: i32, buf: &c.stat) -> usize { pub fn fstat(fd: i32, buf: &c.stat) -> usize {