diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 9bf1c5f4..64c05fff 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1632,10 +1632,16 @@ test "a command pane shows how its command ended, and the next command there run try std.testing.expect(other != dst); while (p.nextEffect()) |_| {} p.update(.{ .output = .{ .pane = @intCast(dst), .bytes = "compiled\r\n" } }); - // Its output ending is not its end: that is its child's exit. - p.update(.{ .eof = .{ .pane = @intCast(dst) } }); - try std.testing.expect(p.panes[dst] == pane and !pane.command_done); + // Its exit comes first, a job it left still printing: done, and not + // the next command's until its pty closes. p.update(.{ .exited = .{ .pane = @intCast(dst), .status = 2 } }); + try std.testing.expect(pane.command_done and pane.command_pty); + const busy = exec.execute(p, 1, "true") orelse return error.NoCommandPane; + try std.testing.expect(busy != dst); + while (p.nextEffect()) |_| {} + // Its output ending: now it may be reused. + p.update(.{ .eof = .{ .pane = @intCast(dst) } }); + try std.testing.expect(p.panes[dst] == pane and !pane.command_pty); try std.testing.expect(p.panes[dst] == pane); try std.testing.expect(pane.command_done); try std.testing.expect(std.mem.endsWith(u8, try tagline.tagPrefix(p, pane), "(make -j8) exit 2")); @@ -4536,6 +4542,7 @@ pub const Pardes = struct { errdefer p.gpa.free(owned); const pane = try panes.Terminal.create(p.gpa, p.screen_w, p.screen_h); pane.command = owned; + pane.command_pty = true; pane.body.mode = .tty; // Its directory is the one it was run for, and says which of the // directory's commands reuse it; the child's own cd does not move it. @@ -5118,6 +5125,7 @@ pub const Pardes = struct { }, .eof => |e| if (p.panes[e.pane]) |pane| if (pane.command != null) { // Output is over; the command is over when its child exits. + pane.command_pty = false; } else p.removePane(e.pane, null) catch |err| { pane.body.mode = .normal; p.reportError(e.pane, "terminal exited; Del retries close", err); |
