| ... | @@ -37,9 +37,6 @@ pub fn create(owner: *std.Build, options: Options) *Fmt { | ... | @@ -37,9 +37,6 @@ pub fn create(owner: *std.Build, options: Options) *Fmt { |
| 37 | } | 37 | } |
| 38 | | 38 | |
| 39 | fn make(step: *Step, prog_node: std.Progress.Node) !void { | 39 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 40 | // zig fmt is fast enough that no progress is needed. | | |
| 41 | _ = prog_node; | | |
| 42 | | | |
| 43 | // TODO: if check=false, this means we are modifying source files in place, which | 40 | // TODO: if check=false, this means we are modifying source files in place, which |
| 44 | // is an operation that could race against other operations also modifying source files | 41 | // is an operation that could race against other operations also modifying source files |
| 45 | // in place. In this case, this step should obtain a write lock while making those | 42 | // in place. In this case, this step should obtain a write lock while making those |
| ... | @@ -68,5 +65,15 @@ fn make(step: *Step, prog_node: std.Progress.Node) !void { | ... | @@ -68,5 +65,15 @@ fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 68 | argv.appendAssumeCapacity(b.pathFromRoot(p)); | 65 | argv.appendAssumeCapacity(b.pathFromRoot(p)); |
| 69 | } | 66 | } |
| 70 | | 67 | |
| 71 | return step.evalChildProcess(argv.items); | 68 | const run_result = try step.captureChildProcess(prog_node, argv.items); |
| | 69 | if (fmt.check) switch (run_result.term) { |
| | 70 | .Exited => |code| if (code != 0 and run_result.stdout.len != 0) { |
| | 71 | var it = std.mem.tokenizeScalar(u8, run_result.stdout, '\n'); |
| | 72 | while (it.next()) |bad_file_name| { |
| | 73 | try step.addError("{s}: non-conforming formatting", .{bad_file_name}); |
| | 74 | } |
| | 75 | }, |
| | 76 | else => {}, |
| | 77 | }; |
| | 78 | try step.handleChildProcessTerm(run_result.term, null, argv.items); |
| 72 | } | 79 | } |