summaryrefslogtreecommitdiff
path: root/test/process.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process.zig')
-rw-r--r--test/process.zig14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/process.zig b/test/process.zig
index bba795de..ba6a84a8 100644
--- a/test/process.zig
+++ b/test/process.zig
@@ -621,8 +621,9 @@ pub const Detached = struct {
.root = dir,
.env = env[0..n],
.unset = if (gui) &.{ "WAYLAND_DISPLAY", "DISPLAY" } else &.{},
- // A window runs on a terminal of its own, as one started from a shell.
- .pty = if (gui) .{ .log = try std.fmt.bufPrintSentinel(&bufs[3], "{s}/{s}.pty", .{ dir, name }, 0) } else null,
+ // A window runs on a terminal of its own, as one started from a
+ // shell, the grid's size: a test window follows its terminal's.
+ .pty = if (gui) .{ .log = try std.fmt.bufPrintSentinel(&bufs[3], "{s}/{s}.pty", .{ dir, name }, 0), .cols = 160, .rows = 50 } else null,
.err_log = try std.fmt.bufPrintSentinel(&bufs[4], "{s}/{s}.stderr", .{ dir, name }, 0),
});
errdefer d.child.deinit();
@@ -793,6 +794,9 @@ pub const Child = struct {
log: [:0]const u8,
/// Made its controlling terminal; else a pty that is no one's.
ctty: bool = true,
+ /// Its size: a test window follows its terminal's (gui.zig's StdinFeed).
+ cols: u16 = 80,
+ rows: u16 = 24,
};
pub const Options = struct {
@@ -806,7 +810,7 @@ pub const Child = struct {
unset: []const [:0]const u8 = &.{},
/// Its stdin, written whole and closed; null: /dev/null.
stdin: ?[]const u8 = null,
- /// Started in a 24x80 pty, its stdin and stdout.
+ /// Started in a pty (80x24 unless it says), its stdin and stdout.
pty: ?Pty = null,
/// Its stderr to this file, not a pipe: a long session's, which
/// nobody reads while it runs and which must never fill. `said`
@@ -837,8 +841,8 @@ pub const Child = struct {
@memcpy(c.err_path[0..path.len], path);
c.err_path_len = path.len;
}
- if (opts.pty != null) {
- var ws: std.posix.winsize = .{ .row = 24, .col = 80, .xpixel = 0, .ypixel = 0 };
+ if (opts.pty) |p| {
+ var ws: std.posix.winsize = .{ .row = p.rows, .col = p.cols, .xpixel = 0, .ypixel = 0 };
if (openpty(&c.master, &c.slave, null, null, &ws) != 0) return error.NoPty;
for ([_]c_int{ c.master, c.slave }) |fd| _ = libc.fcntl(fd, libc.F.SETFD, @as(c_int, 1)); // FD_CLOEXEC
}