From ad3403adb72e3457eb76d6b3fc91cf8df3d738ae Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:51:11 -0300 Subject: A shell that cannot start fails Tty and pty/ctl exec with why, before either answers A shell whose exec failed (a script's missing interpreter) was reported started: Tty and pty/ctl exec succeeded, then the pane died. The child now reports a failed chdir or exec through a close-on-exec pipe the parent reads before acknowledging the shell; the host's spawn fails with the reason (`shell not found`, ENOENT), which fails the waiting write. A Tty whose first shell never ran leaves no pane; a terminal restarted by pty/ctl exec keeps its pane. 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 26c9246a..35b44871 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5023,6 +5023,7 @@ pub const Pardes = struct { if (id < MAX_PANES) if (p.panes[id]) |pane| { ctlfs.pty.shellGone(p, pane, true); // a respawn replaced whatever ran pane.shell_failed = false; + pane.had_shell = true; pane.fs.unmarked = !prompt_marks; // The tag's Tty word names the shell the host ran, and a click // on it (`Tty+fish`) opens another of the same. @@ -5266,6 +5267,11 @@ pub const Pardes = struct { if (pane.command != null and !pane.command_done) { pane.command_pty = false; exec.commandDone(p, id, 127); + } else if (pane.command == null and !pane.had_shell) { + // A Tty whose shell never ran: no dead pane left behind; the + // write that asked for it has failed with why. A terminal whose + // shell was started again (pty/ctl exec) keeps its pane. + p.unplaced.set(id); } } -- cgit v1.3