/// 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, .{}); }