From 44b4eeaf2414963362d0b8f81120349d2cf78e89 Mon Sep 17 00:00:00 2001 From: LN Liberda Date: Fri, 22 May 2026 21:13:31 +0200 Subject: [PATCH] Zig 0.16: Add a global var io --- src/main.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index b65b666..d3ebcb4 100644 --- a/src/main.zig +++ b/src/main.zig @@ -61,6 +61,8 @@ pub const allocator = std.mem.Allocator{ }, }; +pub var io: std.Io = undefined; + // Custom panic impl to reset the terminal before spewing out an error message. pub const panic = std.debug.FullPanic(struct { @@ -331,7 +333,7 @@ fn tryReadArgsFile(path: [:0]const u8) void { defer f.close(); var line_buf: [4096]u8 = undefined; - var line_rd = util.LineReader.init(f, &line_buf); + var line_rd = util.LineReader.init(io, f, &line_buf); while (true) { const line_ = (line_rd.read() catch |e| @@ -464,6 +466,7 @@ fn readImport(path: [:0]const u8) !void { } pub fn main(init: std.process.Init) void { + io = init.io; ui.main_thread = std.Thread.getCurrentId(); // Grab thousands_sep from the current C locale.