Upgrade Zig to the latest (#913)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2022-12-12 08:40:28 +09:00
committed by GitHub
parent 26bd24996e
commit bc37957839
4 changed files with 6 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ on:
env:
EMSDK_VERSION: "3.1.24"
TINYGO_VERSION: "0.26.0"
ZIG_VERSION: "0.11.0-dev.618+096d3efae"
ZIG_VERSION: "0.11.0-dev.725+9bcfe55b5"
concurrency:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run

View File

@@ -7,7 +7,6 @@ pub fn build(b: *std.build.Builder) void {
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("wasi", "wasi.zig");
exe.linkLibC(); // Temporarily force libc usage due to the std.os.isatty bug.
exe.setTarget(CrossTarget{ .cpu_arch = .wasm32, .os_tag = .wasi });
exe.setBuildMode(mode);
exe.install();

View File

@@ -1,4 +1,5 @@
const std = @import("std");
const os = std.os;
const allocator = std.heap.page_allocator;
const preopensAlloc = std.fs.wasi.preopensAlloc;
const stdout = std.io.getStdOut().writer();
@@ -17,10 +18,9 @@ pub fn main() !void {
try stdout.print("./{s}\n", .{entry.name});
}
} else if (std.mem.eql(u8, args[1], "stat")) {
try stdout.print("stdin isatty: {}\n", .{std.c.isatty(0) != 0});
try stdout.print("stdout isatty: {}\n", .{std.c.isatty(1) != 0});
try stdout.print("stderr isatty: {}\n", .{std.c.isatty(2) != 0});
// TODO: use std.os.isatty and remove the dependency on libc after it's fixed to work on WASI target.
try stdout.print("/ isatty: {}\n", .{std.c.isatty(3) != 0});
try stdout.print("stdin isatty: {}\n", .{os.isatty(0)});
try stdout.print("stdout isatty: {}\n", .{os.isatty(1)});
try stdout.print("stderr isatty: {}\n", .{os.isatty(2)});
try stdout.print("/ isatty: {}\n", .{os.isatty(3)});
}
}