diff options
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; |
