Zig 0.16: Add a global var io

This commit is contained in:
LN Liberda 2026-05-22 21:13:31 +02:00
parent f3aa967f84
commit 44b4eeaf24

View file

@ -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.