summaryrefslogtreecommitdiff
path: root/e2e_harness.zig
diff options
context:
space:
mode:
Diffstat (limited to 'e2e_harness.zig')
-rw-r--r--e2e_harness.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/e2e_harness.zig b/e2e_harness.zig
index 05b9c6e5..8b795705 100644
--- a/e2e_harness.zig
+++ b/e2e_harness.zig
@@ -42,11 +42,16 @@ pub const Harness = struct {
trace: bool = false,
pub fn init(gpa: std.mem.Allocator, exe: [*:0]const u8, rows: u16, cols: u16) !Harness {
+ return initArgs(gpa, exe, rows, cols, null);
+ }
+
+ /// Like init, but passes one extra CLI arg to the app (e.g. "--tty").
+ pub fn initArgs(gpa: std.mem.Allocator, exe: [*:0]const u8, rows: u16, cols: u16, arg: ?[*:0]const u8) !Harness {
var master: c_int = undefined;
const ws = posix.winsize{ .row = rows, .col = cols, .xpixel = 0, .ypixel = 0 };
const pid = forkpty(&master, null, null, &ws);
if (pid == 0) {
- const argv = [_:null]?[*:0]const u8{ exe, null };
+ const argv: [3:null]?[*:0]const u8 = .{ exe, arg, null };
_ = execvp(exe, &argv);
_exit(127);
}