authorgravatar for snorredc@gmail.comSnorre <snorredc@gmail.com> 2017-10-03 15:33:30+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-03 09:33:30-04:00
log522b431057d1e03d3068a9880745ccdfc923212e
treee0161726aa9c8fa1f58a6eb707a8933cb4365c5c
parent3af35fc1df7c06ada037cd7371c012ca145ab6e7

fix isatty for macOS and libc (#523)


2 files changed, 3 insertions(+), 3 deletions(-)

std/io.zig+2-2
...@@ -181,7 +181,7 @@ pub const OutStream = struct {...@@ -181,7 +181,7 @@ pub const OutStream = struct {
181 pub fn isTty(self: &OutStream) -> %bool {181 pub fn isTty(self: &OutStream) -> %bool {
182 if (is_posix) {182 if (is_posix) {
183 if (builtin.link_libc) {183 if (builtin.link_libc) {
184 return c.isatty(self.fd) == 0;184 return c.isatty(self.fd) != 0;
185 } else {185 } else {
186 return system.isatty(self.fd);186 return system.isatty(self.fd);
187 }187 }
...@@ -435,7 +435,7 @@ pub const InStream = struct {...@@ -435,7 +435,7 @@ pub const InStream = struct {
435 pub fn isTty(self: &InStream) -> %bool {435 pub fn isTty(self: &InStream) -> %bool {
436 if (is_posix) {436 if (is_posix) {
437 if (builtin.link_libc) {437 if (builtin.link_libc) {
438 return c.isatty(self.fd) == 0;438 return c.isatty(self.fd) != 0;
439 } else {439 } else {
440 return system.isatty(self.fd);440 return system.isatty(self.fd);
441 }441 }
std/os/darwin.zig+1-1
...@@ -125,7 +125,7 @@ pub fn exit(code: i32) -> noreturn {...@@ -125,7 +125,7 @@ pub fn exit(code: i32) -> noreturn {
125}125}
126126
127pub fn isatty(fd: i32) -> bool {127pub fn isatty(fd: i32) -> bool {
128 c.isatty(fd) == 0128 c.isatty(fd) != 0
129}129}
130130
131pub fn fstat(fd: i32, buf: &c.stat) -> usize {131pub fn fstat(fd: i32, buf: &c.stat) -> usize {