Skip to content

Commit 14641ba

Browse files
andrewrkjacobly0
authored andcommitted
stage2: make --color on affect progress bar too
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 ziglang#13560 so that the idea is not lost but we can solve this issue separately.
1 parent 18d3f82 commit 14641ba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Compilation.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,16 @@ pub fn update(comp: *Compilation) !void {
23552355
var progress: std.Progress = .{ .dont_print_on_dumb = true };
23562356
const main_progress_node = progress.start("", 0);
23572357
defer main_progress_node.end();
2358-
if (comp.color == .off) progress.terminal = null;
2358+
switch (comp.color) {
2359+
.off => {
2360+
progress.terminal = null;
2361+
},
2362+
.on => {
2363+
progress.terminal = std.io.getStdErr();
2364+
progress.supports_ansi_escape_codes = true;
2365+
},
2366+
.auto => {},
2367+
}
23592368

23602369
try comp.performAllTheWork(main_progress_node);
23612370

0 commit comments

Comments
 (0)