diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/pty.zig | 12 | ||||
| -rw-r--r-- | src/ninep/testing.zig | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index eda6e9d0..f788b4f8 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -806,6 +806,18 @@ test "a run's answer says cut when its output's start is gone, and reads a bound try testing.expectEqualStrings("error out of memory\n", sh.answered(p, node, h, into)); } +test "closing a terminal pane asks its shell to hang up the pty" { + const p = try withTerm(testing.allocator); + defer p.deinit(); + _ = try th.newPane(p); + const closed = th.rmdir(p, Node.of(serialOf(p), .dir)); + try testing.expectEqual(Status.ok, closed.reply.status); + try testing.expect(closed.closed); + // A text pane has no shell to end. + const text = try th.newPane(p); + try testing.expect(!th.rmdir(p, Node.of(text, .dir)).closed); +} + test "the pty queue drops the oldest at its cap" { const gpa = testing.allocator; const p = try withTerm(gpa); diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index 6ea40956..fce77f10 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -19,6 +19,7 @@ pub const Answer = struct { winsize: ?struct { cols: u16, rows: u16 } = null, signal: ?pardes.PtySignal = null, spawned: bool = false, + closed: bool = false, pub fn pty(a: *const Answer) []const u8 { return a.pty_buf[0..a.pty_len]; @@ -44,6 +45,7 @@ pub fn call(p: *Pardes, req: Req) Answer { }, .resize_pty => |r| ans.winsize = .{ .cols = r.cols, .rows = r.rows }, .signal_pty => |s| ans.signal = s.sig, + .close_pty => ans.closed = true, .spawn => ans.spawned = true, else => {}, }; |
