we should not crash here

This commit is contained in:
cirospaciari
2024-02-15 18:36:22 -03:00
parent 54d7391477
commit acd5ac63b6

View File

@@ -303,11 +303,6 @@ pub const FDImpl = packed struct {
}
pub fn format(this: FDImpl, comptime fmt: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
if (fmt.len == 1 and fmt[0] == 'd') {
try writer.print("{d}", .{this.system()});
return;
}
if (fmt.len != 0) {
@compileError("invalid format string for FDImpl.format. must be either '' or 'd'");
}
@@ -316,6 +311,12 @@ pub const FDImpl = packed struct {
try writer.writeAll("[invalid_fd]");
return;
}
if (fmt.len == 1 and fmt[0] == 'd') {
try writer.print("{d}", .{this.system()});
return;
}
switch (env.os) {
else => {
const fd = this.system();