aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorLee Cannon <leecannon@leecannon.xyz>2021-07-28 02:30:53 +0100
committerGitHub <noreply@github.com>2021-07-27 21:30:53 -0400
commitc234d4790ef51ac05e317e42a0a4836632a5d7a0 (patch)
tree45c142250302eb37f8feb7d0ed40d0f6a801c712 /src/main.zig
parentbb2accba9bf1ec2bf32e7d461785b3084524dbf1 (diff)
downloadzig-c234d4790ef51ac05e317e42a0a4836632a5d7a0.tar.gz
zig-c234d4790ef51ac05e317e42a0a4836632a5d7a0.zip
Add option to hide build command on compilation error to build_runner (#8513)
Co-authored-by: Veikka Tuominen <git@vexu.eu>
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index d0aa6213cb..5b0c9edc8f 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -2753,6 +2753,8 @@ pub const usage_build =
;
pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {
+ var prominent_compile_errors: bool = false;
+
// We want to release all the locks before executing the child process, so we make a nice
// big block here to ensure the cleanup gets run when we extract out our argv.
const child_argv = argv: {
@@ -2804,6 +2806,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
i += 1;
override_global_cache_dir = args[i];
continue;
+ } else if (mem.eql(u8, arg, "--prominent-compile-errors")) {
+ prominent_compile_errors = true;
}
}
try child_argv.append(arg);
@@ -2973,8 +2977,13 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
switch (term) {
.Exited => |code| {
if (code == 0) return cleanExit();
- const cmd = try argvCmd(arena, child_argv);
- fatal("the following build command failed with exit code {d}:\n{s}", .{ code, cmd });
+
+ if (prominent_compile_errors) {
+ fatal("the build command failed with exit code {d}", .{code});
+ } else {
+ const cmd = try argvCmd(arena, child_argv);
+ fatal("the following build command failed with exit code {d}:\n{s}", .{ code, cmd });
+ }
},
else => {
const cmd = try argvCmd(arena, child_argv);