summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:09:47 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit4d4818f7baf356866d323e4b337a64a3dddd8adb (patch)
tree3128484fd60a000c5e0fe207b4e34e658d3bdad6 /src/pardes.zig
parent44aa1ff5bf19b4020e9b4600e5286dea35a3ba5c (diff)
downloadpardes-4d4818f7baf356866d323e4b337a64a3dddd8adb.tar.gz
pardes-4d4818f7baf356866d323e4b337a64a3dddd8adb.zip
pty/ctl exec fails the write when the shell cannot start; a directory removed under a shell leaves its name
`exec` on pty/ctl restarted a shell in a directory that was gone, the write succeeding and the pane dead; and the pane was then renamed `<dir> (deleted)` from /proc, so a restart failed even once the directory was back. `exec` is now refused up front, ENOENT, where the directory is gone; a shell the host cannot start fails the waiting write (late failure, as a Save's); and a `(deleted)` cwd is no name to take. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 60a5dfe3..1afb1e24 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5251,6 +5251,12 @@ pub const Pardes = struct {
p.reportFailure(id, "shell: directory missing (no such directory)")
else
p.reportError(id, "shell", err);
+ // A 9P write that asked for the shell (pty/ctl's exec), waiting on
+ // it, fails with what was said, as a failed Save's does.
+ const said = pane.msg[0..pane.msg_len];
+ 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);
// A command that never started ended: `exit 127`, as a shell says of
// a command it could not run, so a follower waiting on its exit
// hears one, its tag stops saying it runs, and Kill finds nothing.