| ... | ... | @@ -278,12 +278,8 @@ pub fn main() !void { |
| 278 | 278 | .windows_api => {}, |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | | var progress: std.Progress = .{}; |
| 281 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; |
| 282 | 282 | const main_progress_node = progress.start("", 0); |
| 283 | | if (ttyconf == .no_color) { |
| 284 | | progress.timer = null; |
| 285 | | progress.terminal = null; |
| 286 | | } |
| 287 | 283 | |
| 288 | 284 | builder.debug_log_scopes = debug_log_scopes.items; |
| 289 | 285 | builder.resolveInstallPrefix(install_prefix, dir_list); |
| ... | ... | @@ -306,9 +302,6 @@ pub fn main() !void { |
| 306 | 302 | .enable_summary = enable_summary, |
| 307 | 303 | .ttyconf = ttyconf, |
| 308 | 304 | .stderr = stderr, |
| 309 | | |
| 310 | | .step_index = 0, |
| 311 | | .step_count = undefined, |
| 312 | 305 | }; |
| 313 | 306 | |
| 314 | 307 | if (run.max_rss == 0) { |
| ... | ... | @@ -339,9 +332,6 @@ const Run = struct { |
| 339 | 332 | enable_summary: ?bool, |
| 340 | 333 | ttyconf: std.debug.TTY.Config, |
| 341 | 334 | stderr: std.fs.File, |
| 342 | | |
| 343 | | step_count: usize, |
| 344 | | step_index: usize, |
| 345 | 335 | }; |
| 346 | 336 | |
| 347 | 337 | fn runStepNames( |
| ... | ... | @@ -405,8 +395,7 @@ fn runStepNames( |
| 405 | 395 | { |
| 406 | 396 | defer parent_prog_node.end(); |
| 407 | 397 | |
| 408 | | run.step_count = step_stack.count(); |
| 409 | | var step_prog = parent_prog_node.start("run steps", run.step_count); |
| 398 | var step_prog = parent_prog_node.start("run steps", step_stack.count()); |
| 410 | 399 | defer step_prog.end(); |
| 411 | 400 | |
| 412 | 401 | var wait_group: std.Thread.WaitGroup = .{}; |
| ... | ... | @@ -750,27 +739,6 @@ fn workerMakeOneStep( |
| 750 | 739 | sub_prog_node.activate(); |
| 751 | 740 | defer sub_prog_node.end(); |
| 752 | 741 | |
| 753 | | const stderr = run.stderr; |
| 754 | | const ttyconf = run.ttyconf; |
| 755 | | |
| 756 | | // If we are unable to print a fancy terminal progress bar, then we resort |
| 757 | | // to 1 line printed to stderr for each step, similar to Ninja. |
| 758 | | if (ttyconf == .no_color) { |
| 759 | | var buf: [120]u8 = undefined; |
| 760 | | const step_index = @atomicRmw(usize, &run.step_index, .Add, 1, .Monotonic); |
| 761 | | const text = std.fmt.bufPrint(&buf, "[{d}/{d}] Making {s}{s}\n", .{ |
| 762 | | step_index + 1, run.step_count, s.owner.dep_prefix, s.name, |
| 763 | | }) catch |err| switch (err) { |
| 764 | | error.NoSpaceLeft => blk: { |
| 765 | | buf[buf.len - 4 ..].* = "...\n".*; |
| 766 | | break :blk &buf; |
| 767 | | }, |
| 768 | | }; |
| 769 | | std.debug.getStderrMutex().lock(); |
| 770 | | defer std.debug.getStderrMutex().unlock(); |
| 771 | | stderr.writeAll(text) catch {}; |
| 772 | | } |
| 773 | | |
| 774 | 742 | const make_result = s.make(&sub_prog_node); |
| 775 | 743 | |
| 776 | 744 | // No matter the result, we want to display error/warning messages. |
| ... | ... | @@ -778,6 +746,9 @@ fn workerMakeOneStep( |
| 778 | 746 | sub_prog_node.context.lock_stderr(); |
| 779 | 747 | defer sub_prog_node.context.unlock_stderr(); |
| 780 | 748 | |
| 749 | const stderr = run.stderr; |
| 750 | const ttyconf = run.ttyconf; |
| 751 | |
| 781 | 752 | for (s.result_error_msgs.items) |msg| { |
| 782 | 753 | // Sometimes it feels like you just can't catch a break. Finally, |
| 783 | 754 | // with Zig, you can. |