authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-26 19:36:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-26 21:58:19-07:00
logf2e8c79763723e394f57af84af977d91652568b5
treeb2b86f4103cc46b361d8df37da49cdc5bef78346
parent5a8b6149fb0f09d4e221f482b1de225f76bd1840

std.Progress.log: adjust API

Now it will fall back to std.debug.print if there is no tty.

2 files changed, 4 insertions(+), 4 deletions(-)

lib/std/Progress.zig+4-1
......@@ -297,7 +297,10 @@ fn refreshWithHeldLock(self: *Progress) void {
297297}
298298
299299pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void {
300 const file = self.terminal orelse return;
300 const file = self.terminal orelse {
301 std.debug.print(format, args);
302 return;
303 };
301304 self.refresh();
302305 file.writer().print(format, args) catch {
303306 self.terminal = null;
lib/test_runner.zig-3
......@@ -74,7 +74,6 @@ pub fn main() void {
7474 skip_count += 1;
7575 test_node.end();
7676 progress.log("SKIP (async test)\n", .{});
77 if (!have_tty) std.debug.print("SKIP (async test)\n", .{});
7877 continue;
7978 },
8079 } else test_fn.func();
......@@ -86,13 +85,11 @@ pub fn main() void {
8685 error.SkipZigTest => {
8786 skip_count += 1;
8887 progress.log("SKIP\n", .{});
89 if (!have_tty) std.debug.print("SKIP\n", .{});
9088 test_node.end();
9189 },
9290 else => {
9391 fail_count += 1;
9492 progress.log("FAIL ({s})\n", .{@errorName(err)});
95 if (!have_tty) std.debug.print("FAIL ({s})\n", .{@errorName(err)});
9693 if (@errorReturnTrace()) |trace| {
9794 std.debug.dumpStackTrace(trace.*);
9895 }