mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
wasi: fixes os.isatty on type mismatch (#13813)
This commit is contained in:
parent
07f6fc3000
commit
6f39ce93ce
@ -3290,7 +3290,7 @@ pub fn isatty(handle: fd_t) bool {
|
|||||||
if (builtin.os.tag == .wasi) {
|
if (builtin.os.tag == .wasi) {
|
||||||
var statbuf: fdstat_t = undefined;
|
var statbuf: fdstat_t = undefined;
|
||||||
const err = system.fd_fdstat_get(handle, &statbuf);
|
const err = system.fd_fdstat_get(handle, &statbuf);
|
||||||
if (err != 0) {
|
if (err != .SUCCESS) {
|
||||||
// errno = err;
|
// errno = err;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1077,3 +1077,11 @@ test "timerfd" {
|
|||||||
try os.timerfd_settime(tfd, 0, &sit, null);
|
try os.timerfd_settime(tfd, 0, &sit, null);
|
||||||
try expectEqual(try os.poll(&fds, 5), 0);
|
try expectEqual(try os.poll(&fds, 5), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "isatty" {
|
||||||
|
var tmp = tmpDir(.{});
|
||||||
|
defer tmp.cleanup();
|
||||||
|
|
||||||
|
var file = try tmp.dir.createFile("foo", .{});
|
||||||
|
try expectEqual(os.isatty(file.handle), false);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user