From 36a51ddc67d0beb7d9851fb2425cf780a47fed36 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 12:40:11 -0300 Subject: idioms #10, the 9P tree: every bufPrint that fell back to "" or a placeholder is proven to fit (catch unreachable, its why) or cut its argument to fit, /status, /listeners and the 9P reads that staged on gpa answer ENOMEM rather than read short, acme's pane ctl words and pty's files and signals are stringToEnum switches, a dirent's head and name are staged together or not at all, a repeated log record too long to count is pushed as its own line rather than dropped, and daemonList's set is named Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/ninep/screen.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ninep/screen.zig') diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index 33a8717b..634ef640 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -70,12 +70,12 @@ pub fn readSnapshot(p: *Pardes, req: Req, pane: ?*Pane) Reply { } /// /listeners' text, a dial a line, in the step's scratch. -pub fn listenersText(p: *Pardes) []const u8 { +pub fn listenersText(p: *Pardes) std.Io.Writer.Error![]const u8 { var text: std.Io.Writer.Allocating = .init(p.scratch.allocator()); - if (p.fs.socket_path.len != 0) text.writer.print("unix!{s}\n", .{p.fs.socket_path}) catch {}; + if (p.fs.socket_path.len != 0) try text.writer.print("unix!{s}\n", .{p.fs.socket_path}); if (p.fs.tcp_address) |address| switch (address) { - .ip4 => |ip| text.writer.print("tcp!{d}.{d}.{d}.{d}!{d}\n", .{ ip.bytes[0], ip.bytes[1], ip.bytes[2], ip.bytes[3], ip.port }) catch {}, - .ip6 => |ip| text.writer.print("tcp!{f}!{d}\n", .{ std.Io.net.Ip6Address.Unresolved{ .bytes = ip.bytes, .interface_name = null }, ip.port }) catch {}, + .ip4 => |ip| try text.writer.print("tcp!{d}.{d}.{d}.{d}!{d}\n", .{ ip.bytes[0], ip.bytes[1], ip.bytes[2], ip.bytes[3], ip.port }), + .ip6 => |ip| try text.writer.print("tcp!{f}!{d}\n", .{ std.Io.net.Ip6Address.Unresolved{ .bytes = ip.bytes, .interface_name = null }, ip.port }), }; return text.written(); } -- cgit v1.3