From 7b727114350030fa34281803cc12a1dbb7e6f7fc Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:05:05 -0300 Subject: A command from a missing directory fails ENOENT with no pane; one whose shell never started ends exit 127 Exec made a command pane in a directory that was not there, whose shell never started: it said running for ever, a follower waited for an exit that never came, and Kill found it. The line now fails up front, as Tty does, `exec: : no such directory`; and a command pane whose shell the host could not start ends `exit 127` at once. A shell that could not start in its directory says `directory missing`, not `file not found`. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 24595045..60a5dfe3 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5247,7 +5247,17 @@ pub const Pardes = struct { const pane = p.panes[id] orelse return; pane.shell_failed = true; ctlfs.pty.shellGone(p, pane, false); - p.reportError(id, "shell", err); + if (err == error.FileNotFound or err == error.NotDir) + p.reportFailure(id, "shell: directory missing (no such directory)") + else + p.reportError(id, "shell", err); + // 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. + if (pane.command != null and !pane.command_done) { + pane.command_pty = false; + exec.commandDone(p, id, 127); + } } pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void { -- cgit v1.3