Skip to content

Commit

Permalink
CLI: actually fix translate-c creating root progress node twice
Browse files Browse the repository at this point in the history
7281cc1 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.
  • Loading branch information
andrewrk committed May 28, 2024
1 parent 947a3a1 commit 5bdfe22
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -5261,12 +5261,9 @@ 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(.{
.disable_printing = (color == .off),
});
const root_prog_node = if (options.progress_node) |node| node else std.Progress.start(.{
.disable_printing = (color == .off),
});

const target_query: std.Target.Query = .{};
const resolved_target: Package.Module.ResolvedTarget = .{
Expand Down

0 comments on commit 5bdfe22

Please sign in to comment.