From 0ec8d0dc6217486446f2fe2156dff136173a4ef5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:02:47 -0300 Subject: Tty in a missing directory fails and makes no pane; a shell that never started answers runs The host could not start the shell (its chdir failed), and the pane stayed with no pty: a run written to it waited for a prompt for ever. Tty now refuses a directory that is not there, `Tty: : no such directory`, before making a pane; and a terminal whose shell the host could not start (Pardes.shellFailed, from each host's spawn) answers any run with `error shell gone`. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 002ff6f9..3a574dc9 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5010,6 +5010,7 @@ pub const Pardes = struct { pub fn acknowledgeShell(p: *Pardes, id: usize, executable: []const u8, prompt_marks: bool) void { 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.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. @@ -5230,6 +5231,16 @@ pub const Pardes = struct { p.emit(.{ .watch = .{ .pane = id, .on = true } }); } + /// A terminal whose shell could not be started: said, and a run waiting + /// on it, or written to it from now on, hears `error shell gone` + /// rather than wait for a prompt that never comes. + pub fn shellFailed(p: *Pardes, id: u8, err: anyerror) void { + const pane = p.panes[id] orelse return; + pane.shell_failed = true; + ctlfs.pty.shellGone(p, pane, false); + p.reportError(id, "shell", err); + } + pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void { if (p.panes[id]) |pane| if (pane.file) |*f| { // The `-%` spelling fs.zig already uses for "make this dirty". -- cgit v1.3