diff options
Diffstat (limited to 'build/patches/ghostty_kitty.zig')
| -rw-r--r-- | build/patches/ghostty_kitty.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/build/patches/ghostty_kitty.zig b/build/patches/ghostty_kitty.zig new file mode 100644 index 00000000..a86d62d3 --- /dev/null +++ b/build/patches/ghostty_kitty.zig @@ -0,0 +1,15 @@ +/// pardes (build.zig): `path`, opened for reading only once it is known +/// to be a regular file. Elsewhere than Linux, a stat by path first. +fn pardesOpenRegular(io: std.Io, path: []const u8) !std.Io.File { + if (comptime builtin.target.os.tag != .linux) { + if ((try std.Io.Dir.cwd().statFile(io, path, .{})).kind != .file) return error.NotRegularFile; + return std.Io.Dir.cwd().openFile(io, path, .{}); + } + const probe = try std.Io.Dir.cwd().openFile(io, path, .{ .path_only = true }); + defer probe.close(io); + const stat = try probe.stat(io); + if (stat.kind != .file) return error.NotRegularFile; + var buf: [32]u8 = undefined; + const same = std.fmt.bufPrint(&buf, "/proc/self/fd/{d}", .{probe.handle}) catch unreachable; + return std.Io.Dir.cwd().openFile(io, same, .{}); +} |
