mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
build: avoid intermixed messages on the same line
In same cases, the progress messages from the compiler are intermixed with the messages printed by ZiglingStep. This intermixing appears in two cases: - when printing, e.g., the message "Checking 0_arrays2.zig..." - when printing the compiler errors Closes #230
This commit is contained in:
parent
c6e055dd83
commit
30db9d105a
1 changed files with 9 additions and 0 deletions
|
@ -728,6 +728,7 @@ const ZiglingStep = struct {
|
|||
|
||||
const exe_file = try self.doCompile(prog_node);
|
||||
|
||||
resetLine();
|
||||
print("Checking {s}...\n", .{self.exercise.main_file});
|
||||
|
||||
const cwd = self.builder.build_root.path.?;
|
||||
|
@ -970,6 +971,8 @@ const ZiglingStep = struct {
|
|||
}
|
||||
|
||||
fn printErrors(self: *ZiglingStep) void {
|
||||
resetLine();
|
||||
|
||||
// Print the additional log and verbose messages.
|
||||
// TODO: use colors?
|
||||
if (self.result_messages.len > 0) print("{s}", .{self.result_messages});
|
||||
|
@ -986,6 +989,12 @@ const ZiglingStep = struct {
|
|||
}
|
||||
};
|
||||
|
||||
// Clear the entire line and move the cursor to column zero.
|
||||
// Used for clearing the compiler and build_runner progress messages.
|
||||
fn resetLine() void {
|
||||
if (use_color_escapes) print("{s}", .{"\x1b[2K\r"});
|
||||
}
|
||||
|
||||
// Print a message to stderr.
|
||||
const PrintStep = struct {
|
||||
step: Step,
|
||||
|
|
Loading…
Reference in a new issue