summaryrefslogtreecommitdiff
path: root/src/9p_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 13:05:18 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitdc37b4ea777b7eb881a993e737457c18699c5b2c (patch)
tree3f65229ed1e4c41090cf9fd10fbdf6d640652578 /src/9p_io.zig
parentebcb870ac8ea962fd705068c7aaff935c5a5c15b (diff)
downloadpardes-dc37b4ea777b7eb881a993e737457c18699c5b2c.tar.gz
pardes-dc37b4ea777b7eb881a993e737457c18699c5b2c.zip
pardes FILE in a pane whose session answers never falls back to a nested editor: the refusal is printed, exit 1, and no stray pane is left
When the environment named a live session that answered, several failures broke out of forwarding and started a whole editor inside the pane that asked: a refused name, a pane the session has not, a failed look write. Its screen was drawn over the shell. Now, once the session answers (Client.probe), every refusal is printed as `pardes: <file>: <why>`, in the session's own words (the Rerror, now kept by the client), and the launch exits 1, as acme's B does. A new name the session refuses deletes the pane made for it, so no empty +New is left. A missing environment or a session that does not answer still starts a separate editor. fs.py checks a refused name and a stale PARDES_PANE. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/9p_io.zig')
-rw-r--r--src/9p_io.zig17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig
index d1b2099c..5a68238c 100644
--- a/src/9p_io.zig
+++ b/src/9p_io.zig
@@ -1808,7 +1808,17 @@ pub const Client = struct {
var sock_buf: [sun_path_len]u8 = undefined;
const sock = try resolve(&sock_buf, dial);
var remote: RemoteError = .{};
- return fetchBytes(gpa, sock, names[0..n], &remote, null, display_path, @min(max_bytes, limits.max_file_bytes));
+ return fetchBytes(gpa, sock, names[0..n], &remote, null, display_path, @min(max_bytes, limits.max_file_bytes)) catch |err| {
+ if (err == error.Remote) said = remote;
+ return err;
+ };
+ }
+
+ /// The peer's own words for the last error.Remote a read or write here
+ /// got (its Rerror), for a caller that says why.
+ var said: RemoteError = .{};
+ pub fn lastSaid() []const u8 {
+ return said.buf[0..said.len];
}
/// Whether a peer answers at `dial`: a version and attach, and its root
@@ -1828,7 +1838,10 @@ pub const Client = struct {
var sock_buf: [sun_path_len]u8 = undefined;
const sock = try resolve(&sock_buf, dial);
var remote: RemoteError = .{};
- const result = try fetchBytes(gpa, sock, names[0..n], &remote, bytes, path, limits.max_file_bytes);
+ const result = fetchBytes(gpa, sock, names[0..n], &remote, bytes, path, limits.max_file_bytes) catch |err| {
+ if (err == error.Remote) said = remote;
+ return err;
+ };
gpa.free(result);
}