mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 22:34:28 +00:00
std.Progress.log: adjust API
Now it will fall back to std.debug.print if there is no tty.
This commit is contained in:
parent
5a8b6149fb
commit
f2e8c79763
2 changed files with 4 additions and 4 deletions
|
|
@ -297,7 +297,10 @@ fn refreshWithHeldLock(self: *Progress) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void {
|
pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void {
|
||||||
const file = self.terminal orelse return;
|
const file = self.terminal orelse {
|
||||||
|
std.debug.print(format, args);
|
||||||
|
return;
|
||||||
|
};
|
||||||
self.refresh();
|
self.refresh();
|
||||||
file.writer().print(format, args) catch {
|
file.writer().print(format, args) catch {
|
||||||
self.terminal = null;
|
self.terminal = null;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ pub fn main() void {
|
||||||
skip_count += 1;
|
skip_count += 1;
|
||||||
test_node.end();
|
test_node.end();
|
||||||
progress.log("SKIP (async test)\n", .{});
|
progress.log("SKIP (async test)\n", .{});
|
||||||
if (!have_tty) std.debug.print("SKIP (async test)\n", .{});
|
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
} else test_fn.func();
|
} else test_fn.func();
|
||||||
|
|
@ -86,13 +85,11 @@ pub fn main() void {
|
||||||
error.SkipZigTest => {
|
error.SkipZigTest => {
|
||||||
skip_count += 1;
|
skip_count += 1;
|
||||||
progress.log("SKIP\n", .{});
|
progress.log("SKIP\n", .{});
|
||||||
if (!have_tty) std.debug.print("SKIP\n", .{});
|
|
||||||
test_node.end();
|
test_node.end();
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
fail_count += 1;
|
fail_count += 1;
|
||||||
progress.log("FAIL ({s})\n", .{@errorName(err)});
|
progress.log("FAIL ({s})\n", .{@errorName(err)});
|
||||||
if (!have_tty) std.debug.print("FAIL ({s})\n", .{@errorName(err)});
|
|
||||||
if (@errorReturnTrace()) |trace| {
|
if (@errorReturnTrace()) |trace| {
|
||||||
std.debug.dumpStackTrace(trace.*);
|
std.debug.dumpStackTrace(trace.*);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue