summaryrefslogtreecommitdiff
path: root/test/process/terminals.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process/terminals.zig')
-rw-r--r--test/process/terminals.zig17
1 files changed, 2 insertions, 15 deletions
diff --git a/test/process/terminals.zig b/test/process/terminals.zig
index 151b221b..8d595120 100644
--- a/test/process/terminals.zig
+++ b/test/process/terminals.zig
@@ -111,15 +111,6 @@ fn sizeLines(a: std.mem.Allocator, c: *process.Conn, n: u32) ![]const []const u8
return out.items;
}
-/// A shell takes runs: its first prompt, or the one started again.
-fn prompted(a: std.mem.Allocator, c: *process.Conn, term: u32) !void {
- const deadline = eh.nowMs() + 10_000;
- while (!std.mem.eql(u8, try run(a, c, term, "true\n"), "exit 0\n")) {
- if (eh.nowMs() > deadline) return error.NoPrompt;
- process.sleep(50);
- }
-}
-
fn sizedFork(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var d = try process.Detached.start(gpa, exe, "sized", .{});
defer d.deinit();
@@ -135,7 +126,7 @@ fn sizedFork(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// the screen's 160x50.
try c.write("/exec", "Term\n");
const term = try c.newest(gpa);
- try prompted(a, c, term);
+ // Asked at once: a run waits for its first prompt and its greeting.
var got = try sttySize(a, c, term);
try expect(!std.mem.eql(u8, got[1], "50 160"));
try expectEqualStrings(got[1], got[0]);
@@ -200,11 +191,7 @@ fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
const serial = try std.fmt.parseInt(u32, w.next().?, 10);
if (std.mem.eql(u8, w.next().?, "term")) term = @max(term, serial);
}
- const deadline = eh.nowMs() + 10_000;
- while (std.mem.eql(u8, try run(a, c, term, "true\n"), "busy\n")) { // deadline its first prompt
- if (eh.nowMs() > deadline) return error.NoPrompt;
- process.sleep(50);
- }
+ try expectEqualStrings("exit 0\n", try run(a, c, term, "true\n")); // asked at once: it waits for the first prompt, and the greeting's
try expectEqualStrings("exit 1\n", try run(a, c, term, "false\n"));
try expectEqualStrings("exit 0\none\ntwo\n", try run(a, c, term, "printf \"one\\ntwo\\n\"\n")); // then what it printed
try expectEqualStrings("exit 7\n", try run(a, c, term, "sh -c \"exit 7\"\n"));