aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/os/kernel_info.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/os/kernel_info.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/os/kernel_info.zig')
-rw-r--r--vendor/libghostty-vt/src/os/kernel_info.zig13
1 files changed, 9 insertions, 4 deletions
diff --git a/vendor/libghostty-vt/src/os/kernel_info.zig b/vendor/libghostty-vt/src/os/kernel_info.zig
index e57cc304..60e6b49f 100644
--- a/vendor/libghostty-vt/src/os/kernel_info.zig
+++ b/vendor/libghostty-vt/src/os/kernel_info.zig
@@ -1,15 +1,20 @@
const std = @import("std");
const builtin = @import("builtin");
+const global = @import("../global.zig");
pub fn getKernelInfo(alloc: std.mem.Allocator) ?[]const u8 {
if (comptime builtin.os.tag != .linux) return null;
const path = "/proc/sys/kernel/osrelease";
- var file = std.fs.openFileAbsolute(path, .{}) catch return null;
- defer file.close();
+ var file = std.Io.Dir.openFileAbsolute(global.io(), path, .{}) catch return null;
+ defer file.close(global.io());
// 128 bytes should be enough to hold the kernel information
- const kernel_info = file.readToEndAlloc(alloc, 128) catch return null;
- defer alloc.free(kernel_info);
+ var kernel_info_buf: [128]u8 = undefined;
+ const kernel_info = kernel_info_buf[0 .. file.readPositionalAll(
+ global.io(),
+ &kernel_info_buf,
+ 0,
+ ) catch return null];
return alloc.dupe(u8, std.mem.trim(u8, kernel_info, &std.ascii.whitespace)) catch return null;
}