summaryrefslogtreecommitdiff
path: root/src/ninep/pty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 14:39:47 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commite8e7ed956f3914a3790e980df0862b26c30bd611 (patch)
tree53d3247c594717f79745ad20c5dd23bf16ed59ea /src/ninep/pty.zig
parenta821fe82d8de3d407ebe104358b97719bd983727 (diff)
downloadpardes-e8e7ed956f3914a3790e980df0862b26c30bd611.tar.gz
pardes-e8e7ed956f3914a3790e980df0862b26c30bd611.zip
idioms #20, the bound in the type or the cut handled: of the 166 `catch unreachable` the pass kept, 64 stay where a reader checks the bound without arithmetic (an integer's digits, a declared field's size, and now the daemon's pid lists and the clock's two-digit fields written in their types), 69 texts print through Kind.Buf at their old size, 31 handle the failure once (a print into ename cut at its 320, paneText's line cut where its buffer fills, a log record or mouse report dropped rather than cut short, the question's letters that fit), Newcol's and pane/new's refusals are comptime strings, and dropUnsaved's too-long scratch name is null, not an empty sentinel
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/pty.zig')
-rw-r--r--src/ninep/pty.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index 2a4fc1ed..8514c669 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -61,13 +61,13 @@ pub fn writeCtl(p: *Pardes, req: Req, id: usize) Reply {
// refused before anything runs, as Term there is.
const dir = pane.cwdSlice();
if (pardes.exec.missingDir(p, dir))
- return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}: no such directory", .{dir[0..@min(dir.len, 256)]}) catch unreachable); // 256 fit 320
+ return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}: no such directory", .{dir[0..@min(dir.len, 256)]}) catch &p.fs.ename); // cut to ename's 320
// Nor is a shell that is not there, or a script whose
// interpreter is not: refused, and the running shell kept.
const bin = pane.shell orelse p.shellBin();
var why: [320]u8 = undefined;
if (pardes.tape.value(.shell, @import("../host_io.zig").Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused|
- return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused[0..@min(refused.len, 300)]}) catch unreachable); // 300 fit 320
+ return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused[0..@min(refused.len, 300)]}) catch &p.fs.ename); // cut to ename's 320
};
if (verb(p, id, line, apply)) |why| return tree.failText(req.tag, E.INVAL, why);
}