CLI: actually fix translate-c creating root progress node twice

7281cc1d839da6e84bb76fadb2c1eafc22a82df7 did not solve the problem
because even when Node.index is none, it still counts as initializing
the global Progress object. Just use a normal zig optional, and all is
good.
This commit is contained in:
Andrew Kelley 2024-05-27 20:53:25 -07:00
parent 947a3a1be9
commit 5bdfe22092

View file

@ -5251,7 +5251,7 @@ const JitCmdOptions = struct {
capture: ?*[]u8 = null,
/// Send error bundles via std.zig.Server over stdout
server: bool = false,
progress_node: std.Progress.Node = .{ .index = .none },
progress_node: ?std.Progress.Node = null,
};
fn jitCmd(
@ -5261,10 +5261,7 @@ fn jitCmd(
options: JitCmdOptions,
) !void {
const color: Color = .auto;
const root_prog_node = if (options.progress_node.index != .none)
options.progress_node
else
std.Progress.start(.{
const root_prog_node = if (options.progress_node) |node| node else std.Progress.start(.{
.disable_printing = (color == .off),
});