From 522b431057d1e03d3068a9880745ccdfc923212e Mon Sep 17 00:00:00 2001 From: Snorre Date: Tue, 3 Oct 2017 15:33:30 +0200 Subject: [PATCH] fix isatty for macOS and libc (#523) --- std/io.zig | 4 ++-- std/os/darwin.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/std/io.zig b/std/io.zig index 1054e002f0..7ca89d587f 100644 --- a/std/io.zig +++ b/std/io.zig @@ -181,7 +181,7 @@ pub const OutStream = struct { pub fn isTty(self: &OutStream) -> %bool { if (is_posix) { if (builtin.link_libc) { - return c.isatty(self.fd) == 0; + return c.isatty(self.fd) != 0; } else { return system.isatty(self.fd); } @@ -435,7 +435,7 @@ pub const InStream = struct { pub fn isTty(self: &InStream) -> %bool { if (is_posix) { if (builtin.link_libc) { - return c.isatty(self.fd) == 0; + return c.isatty(self.fd) != 0; } else { return system.isatty(self.fd); } diff --git a/std/os/darwin.zig b/std/os/darwin.zig index 149523b069..718cfe56a9 100644 --- a/std/os/darwin.zig +++ b/std/os/darwin.zig @@ -125,7 +125,7 @@ pub fn exit(code: i32) -> noreturn { } pub fn isatty(fd: i32) -> bool { - c.isatty(fd) == 0 + c.isatty(fd) != 0 } pub fn fstat(fd: i32, buf: &c.stat) -> usize {