From 396791f7ca7a03d1cb58a9db35d4d4314ee0c6e9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 9 Nov 2026 03:31:33 -0300 Subject: idioms: the terminal host's tasks say what they fail with: readPty returns error{OutOfMemory} and watchFiles nothing, their futures typed so, for anyerror Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/tui/tui.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/tui/tui.zig b/src/tui/tui.zig index d5d3a782..af274b3f 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -380,7 +380,7 @@ const PipeTasks = selection_pipe.Tasks; const Pty = struct { file: std.Io.File, pid: posix.pid_t, - reader: std.Io.Future(anyerror!void), + reader: std.Io.Future(error{OutOfMemory}!void), /// A command pane's child, watched to its exit (host_io.watchExit); /// the pty stays open until both its end of file and its exit. cmd: host_io.CommandWatch = .{}, @@ -1030,7 +1030,7 @@ fn localSession( core.stream.cancelTask(); file_watch.stop(sh.inotify_fd); if (sh.watch_task) |*t| { - t.cancel(io) catch {}; + t.cancel(io); sh.watch_task = null; } if (sh.inotify_fd >= 0) { @@ -1196,7 +1196,7 @@ const Shell = struct { ptys: [pardes.MAX_PANES]?Pty = @splat(null), gens: [pardes.MAX_PANES]u32 = @splat(0), watches: file_watch.Table = @splat(null), - watch_task: ?std.Io.Future(anyerror!void) = null, + watch_task: ?std.Io.Future(void) = null, lsp_task: ?host_io.Lsp.Task = null, pipe_tasks: PipeTasks = .{}, job_tasks: PipeTasks = .{}, @@ -2223,7 +2223,7 @@ fn lspStatusSink(ctx: ?*anyopaque, text: []const u8) void { if (!posted) s.lsp_gpa.free(copy); } -fn watchFiles(io: std.Io, fd: c_int, loop: *Loop) anyerror!void { +fn watchFiles(io: std.Io, fd: c_int, loop: *Loop) void { if (comptime builtin.os.tag != .linux and builtin.os.tag != .freebsd) { while (file_watch.wait(fd)) loop.postEvent(.files_changed) catch break; return; @@ -2325,7 +2325,7 @@ fn tookRead(io: std.Io, id: usize) void { }; } -fn readPty(io: std.Io, gpa: std.mem.Allocator, pty: std.Io.File, id: usize, gen: u32, loop: *Loop) anyerror!void { +fn readPty(io: std.Io, gpa: std.mem.Allocator, pty: std.Io.File, id: usize, gen: u32, loop: *Loop) error{OutOfMemory}!void { // One buffer, read into directly: a Reader around it only added a second // (and in a safe build, filled both as `undefined` on every start). var buf: [0x10000]u8 = undefined; -- cgit v1.3