diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 22:20:09 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | fe9786bf845f844315221e08eba793ac1d27ae9d (patch) | |
| tree | 4e9a1591a79f43b6d80f3fba93ec6867182b7740 /src/dump.zig | |
| parent | 4793520998969439bb569c968c3143ae46aefc66 (diff) | |
| download | pardes-fe9786bf845f844315221e08eba793ac1d27ae9d.tar.gz pardes-fe9786bf845f844315221e08eba793ac1d27ae9d.zip | |
A restored command pane comes back finished, not as a live shell
After Restore a dogfood agent's command panes were fish shells under a stale
`(make) exit 0` tag. The dump's terminal record now keeps a command pane's
line and status, and Restore brings it back done: what it printed, its exit,
no shell and no rerun.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dump.zig b/src/dump.zig index 446776d4..54fd1da1 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -102,6 +102,10 @@ pub const Terminal = struct { /// The shell it runs when not the configured one (`Tty bash`); empty, /// the configured one, as in dumps from before. shell: []const u8 = "", + /// A command pane's line and how it ended (null: unknown, or still + /// running when dumped); empty for an interactive terminal. + command: []const u8 = "", + status: ?u8 = null, /// The rendered scrollback and screen as plain text, one row per line. stream: []const u8 = "", stream_b64: []const u8 = "", @@ -745,12 +749,19 @@ fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previo // A host that runs shells gets them back: the old history // above a new shell in the directory it was in. The web // shell and an isolated build only ever replay it. + // A command pane comes back finished, showing what it said + // and how it ended: its command is not run again. const live = comptime (terminal_panes and platform != .web and !isolated); - const revive = live and t.cwd.len <= effect_path_cap; + const revive = live and t.cwd.len <= effect_path_cap and t.command.len == 0; const restored = try pardes.panes.Terminal.restore(p, src, revive); p.installPane(i, restored); try restored.setOwnedCwd(t.cwd); if (t.shell.len > 0) restored.shell = try gpa.dupe(u8, t.shell); + if (t.command.len > 0) { + restored.command = try gpa.dupe(u8, t.command); + restored.command_done = true; + restored.command_status = t.status; + } if (std.mem.startsWith(u8, src.tag, "TTY ")) restored.body.mode = .tty; if (revive) p.emit(.{ .spawn = .{ .pane = @intCast(i), .serial = restored.serial, .cwd = .from(t.cwd) } }); break :terminal restored; |
