summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:14:58 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commit4839c4b037d401393bbc87143d663e115c71242e (patch)
tree6d23e1cd9aaf89404dd53f03e6ada23588b42dcc /src/host_io.zig
parent77671575bd2f481651ea54e956ac5c7da8d63710 (diff)
downloadpardes-4839c4b037d401393bbc87143d663e115c71242e.tar.gz
pardes-4839c4b037d401393bbc87143d663e115c71242e.zip
idioms #2, formats that cannot overflow say so: a bufPrint or a fixed writer whose buffer provably holds the text (numbers, a 128-byte name, a short phrase) is catch unreachable with its reason, not a catch "" or a stand-in sentence nobody can reach, and dump.check takes its 256-byte why as such
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index a363a578..3fed6e1d 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -231,7 +231,7 @@ pub const Adoptions = struct {
pub fn adoptShell(a: *Adoptions, core: *pardes.Pardes, pid: libc.pid_t, fd: c_int) void {
if (pid == 0) {
var buf: [96]u8 = undefined;
- return core.setMessage(core.view().active, if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }) catch "Adopt: shells taken in");
+ return core.setMessage(core.view().active, if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }) catch unreachable); // a count fits 96
}
if (a.len < a.list.len) {
a.list[a.len] = .{ .pid = pid, .fd = fd, .pane = null };
@@ -246,7 +246,7 @@ pub const Adoptions = struct {
// No room for it: its master goes, and the shell with this session.
_ = libc.close(fd);
var buf: [96]u8 = undefined;
- core.setMessage(core.view().active, std.fmt.bufPrint(&buf, "Adopt: no room for shell {d}; it ends with this session", .{pid}) catch "Adopt: no room for a shell");
+ core.setMessage(core.view().active, std.fmt.bufPrint(&buf, "Adopt: no room for shell {d}; it ends with this session", .{pid}) catch unreachable); // a pid fits 96
}
/// The adopted shell pane `pane`'s spawn takes, off the list.