diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 10:02:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | c44894f53decbacc68c0e4e9d1118fc082bc63a0 (patch) | |
| tree | 09a58290831c688370fb20bddb6c49635196fbdc /src/Messages.zig | |
| parent | f5c48e98b80ad6517c756e8fd15c976d4a2d1894 (diff) | |
| download | pardes-c44894f53decbacc68c0e4e9d1118fc082bc63a0.tar.gz pardes-c44894f53decbacc68c0e4e9d1118fc082bc63a0.zip | |
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 <[email protected]>
Diffstat (limited to 'src/Messages.zig')
| -rw-r--r-- | src/Messages.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Messages.zig b/src/Messages.zig index c7ff09be..f4ea1c3e 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -388,6 +388,12 @@ pub fn messageLog(m: *const Messages, i: usize) ?*const LoggedMessage { pub fn reportError(p: *Pardes, id: usize, operation: []const u8, err: anyerror) void { var buf: [256]u8 = undefined; const text = std.fmt.bufPrint(&buf, "{s}: {s}", .{ operation, @errorName(err) }) catch operation; + // A builtin a ctl write runs: its first error is also the write's. + if (p.fs.no_prompt and p.fs.failure_len == 0) { + const n = @min(text.len, p.fs.failure.len); + @memcpy(p.fs.failure[0..n], text[0..n]); + p.fs.failure_len = @intCast(n); + } setMessage(p, id, text); } |
