authorgravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2022-12-11 17:44:38+09:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-12-11 03:44:38-05:00
log78ea270cc63197e4af312463d4f0c5490285d6ba
tree6ae6236e5a31b8ade8f6cfde47979c8d2ed34455
parentcffbb32d31495c83addae7ed3882dc000fb327aa
signature Signed by PGP key 4AEE18F83AFDEB23

wasi: fixes os.isatty on type mismatch (#13813)


2 files changed, 9 insertions(+), 1 deletions(-)

lib/std/os.zig+1-1
......@@ -3158,7 +3158,7 @@ pub fn isatty(handle: fd_t) bool {
31583158 if (builtin.os.tag == .wasi) {
31593159 var statbuf: fdstat_t = undefined;
31603160 const err = system.fd_fdstat_get(handle, &statbuf);
3161 if (err != 0) {
3161 if (err != .SUCCESS) {
31623162 // errno = err;
31633163 return false;
31643164 }
lib/std/os/test.zig+8
......@@ -1065,3 +1065,11 @@ test "timerfd" {
10651065 try os.timerfd_settime(tfd, 0, &sit, null);
10661066 try expectEqual(try os.poll(&fds, 5), 0);
10671067}
1068
1069test "isatty" {
1070 var tmp = tmpDir(.{});
1071 defer tmp.cleanup();
1072
1073 var file = try tmp.dir.createFile("foo", .{});
1074 try expectEqual(os.isatty(file.handle), false);
1075}