From 4d4818f7baf356866d323e4b337a64a3dddd8adb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:09:47 -0300 Subject: 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 ` (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 --- src/pardes.zig | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/pardes.zig') 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. -- cgit v1.3