From c44894f53decbacc68c0e4e9d1118fc082bc63a0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 10:02:33 -0300 Subject: A ctl write fails when a builtin it runs fails, and a missing required argument is refused before anything runs A ctl write failed only on a malformed line: Mount x reported its error in the editor while the write succeeded, and a bare Mount failed only as it ran, after earlier lines of the write. acme's ctl answers a command's error (editors/acme/xfid.c:700). Builtins now declare requires_arg beside takes_arg (settings: those with a value to set), and the check refuses a bare one as wrong #args before any line runs; while a ctl runs, the first error a builtin reports fails the write, quoted with its line, and the prompt refusal quotes its line too. Docs say what a failure mid-write leaves done. Co-Authored-By: Claude Opus 5.5 --- src/fs.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/fs.zig') diff --git a/src/fs.zig b/src/fs.zig index 339910a4..022a326a 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -1257,9 +1257,13 @@ pub const Namespace = struct { listeners: u16 = 0, origin: u8 = 'K', /// A ctl write is running builtins: one that would open a prompt for - /// its argument refuses (`refused`), since nobody is at the prompt. + /// its argument refuses (`refused`), since nobody is at the prompt, and + /// the first error one reports (`failure`) fails the write, as acme's + /// ctl answers a command's error (editors/acme/xfid.c:700). no_prompt: bool = false, refused: bool = false, + failure: [96]u8 = undefined, + failure_len: u8 = 0, /// A refusal that quotes the message it refuses, as Plan 9's cmderror /// does (kernel/misc/parse.c:82); answered at once (src/9p_io.zig). ename: [128]u8 = undefined, -- cgit v1.3