diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 23:13:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 90530f893236c665deb9f5bddc925ee1fe51cca5 (patch) | |
| tree | f9fb5a34731eab09fddae5751d3cc8450c796853 /src/pardes.zig | |
| parent | 8b2a55f31169ede82e11a573ab655e72e7831fe7 (diff) | |
| download | pardes-90530f893236c665deb9f5bddc925ee1fe51cca5.tar.gz pardes-90530f893236c665deb9f5bddc925ee1fe51cca5.zip | |
A failed Dump or a Restore of no dump fails its write, before any warning
A Dump into a DumpDir it could not write, or a Restore of a file that is
not a dump, answered a ctl write with rc 0 and only a message, and the
Restore warned about unsaved panes before it ever looked at the file. The
hosts' dump write now fails the waiting 9P write with EIO (the late failure
a Save uses), naming the path and the reason in the log, and Restore parses
the file before its unsaved-panes refusal, failing with `not a pardes
dump`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 452f6174..c2bde804 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5105,6 +5105,20 @@ pub const Pardes = struct { p.fs.late_failure_len = @intCast(kept.len); } + /// A Dump the host could not write: said on the message row and in the + /// log, and the 9P write that asked for it fails with it, as a failed + /// Save's does. + pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void { + var what: [limits.host_path_cap + 8]u8 = undefined; + const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path}) catch "Dump"; + p.reportError(p.active, operation, err); + var buf: [256]u8 = undefined; + const said = std.fmt.bufPrint(&buf, "{s}: {s}", .{ operation, @errorName(err) }) catch "Dump failed"; + const kept = @import("Messages.zig").clip(said, p.fs.late_failure.len); + @memcpy(p.fs.late_failure[0..kept.len], kept); + p.fs.late_failure_len = @intCast(kept.len); + } + /// The path a watch is about: a real file's, or a PDF's. fn watchPath(p: *const Pardes, id: u8) ?[]const u8 { const pane = p.panes[id] orelse return null; |
