Skip to content

Commit

Permalink
stage2: make --color on affect progress bar too
Browse files Browse the repository at this point in the history
Before, --color on would affect colored compile error printing but not
affect terminal progress bar printing. It was intended for this option
to affect both; now it does.

This causes a failure when building the language reference, which
contains code for parsing terminal output and rendering HTML. Now it
must be expanded to handle 'K' and 'D' codes to simulate a terminal
cursor moving, and the CI will fail until that capability is added in a
later commit of this branch.

I extracted this change from #13560 so that the idea is not lost but we
can solve this issue separately.
  • Loading branch information
andrewrk authored and Vexu committed Jan 3, 2023
1 parent 5bd69c6 commit a31ff07
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2356,7 +2356,16 @@ pub fn update(comp: *Compilation) !void {
var progress: std.Progress = .{ .dont_print_on_dumb = true };
const main_progress_node = progress.start("", 0);
defer main_progress_node.end();
if (comp.color == .off) progress.terminal = null;
switch (comp.color) {
.off => {
progress.terminal = null;
},
.on => {
progress.terminal = std.io.getStdErr();
progress.supports_ansi_escape_codes = true;
},
.auto => {},
}

try comp.performAllTheWork(main_progress_node);

Expand Down

0 comments on commit a31ff07

Please sign in to comment.