From 015152bb7e28a26d135fc4bc67b09a5f53d5080b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 20:51:06 -0300 Subject: A shell that exits under a run answers exit N, and the log says exit before del A dogfood agent ran `exit 3` through pty/run: the reader got ENOENT, and the log went straight to del. The hosts now read a shell's exit status at its pty's end as they do a command's; a run waiting on the line answers `exit 3` with what it printed, the log says `exit 3` before the pane's `del`, and an open run still stats after its pane is gone (cat fstats its input). Pins cloud9 f35b7ed, whose stat of an open fid names its open. Writes to a gone pane's pty/data, held open or not, fail ENOENT. Co-Authored-By: Claude Opus 5.5 --- src/tty/tty.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/tty/tty.zig') diff --git a/src/tty/tty.zig b/src/tty/tty.zig index d17316e8..b18f4de5 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -1050,12 +1050,13 @@ const Shell = struct { return true; } _ = libc.close(pt.file.handle); - // Unwatched, a command's exit is read here, as its end. + // Unwatched, a command's exit is read here, as its end, + // and a shell's, for a run waiting on it and the log. const command = if (core.panes[e.id]) |pn| pn.command != null else false; - const status = if (command) host_io.exitStatus(pt.pid, 100) else null; + const status = host_io.exitStatus(pt.pid, 100); if (status == null) host_io.retireShell(pt.pid); s.ptys[e.id] = null; - if (command) core.update(.{ .exited = .{ .pane = @intCast(e.id), .status = status } }); + if (command or status != null) core.update(.{ .exited = .{ .pane = @intCast(e.id), .status = status } }); } core.update(.{ .eof = .{ .pane = @intCast(e.id) } }); }, -- cgit v1.3