authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2021-01-02 04:08:59+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2021-01-02 04:09:59+11:00
logb3c9dfc9cc843c2bf9e2c3490334092ea4d9d5a7
tree83b43cf3e3049f11f9b3ba1ef2d79872ecb20cd8
parentad1780959dbe422681354e883bc0beb032742cc1
signaturelock-open Commit is signed but in an unrecognized format.

Don't process.exit() on invalid option use .markInvalidUserInput


1 files changed, 10 insertions(+), 7 deletions(-)

lib/std/build.zig+10-7
......@@ -653,7 +653,8 @@ pub const Builder = struct {
653653 for (diags.arch.?.allCpuModels()) |cpu| {
654654 warn(" {}\n", .{cpu.name});
655655 }
656 process.exit(1);
656 self.markInvalidUserInput();
657 return args.default_target;
657658 },
658659 error.UnknownCpuFeature => {
659660 warn(
......@@ -667,7 +668,8 @@ pub const Builder = struct {
667668 for (diags.arch.?.allFeaturesList()) |feature| {
668669 warn(" {}: {}\n", .{ feature.name, feature.description });
669670 }
670 process.exit(1);
671 self.markInvalidUserInput();
672 return args.default_target;
671673 },
672674 error.UnknownOperatingSystem => {
673675 warn(
......@@ -678,11 +680,13 @@ pub const Builder = struct {
678680 inline for (std.meta.fields(std.Target.Os.Tag)) |field| {
679681 warn(" {}\n", .{field.name});
680682 }
681 process.exit(1);
683 self.markInvalidUserInput();
684 return args.default_target;
682685 },
683686 else => |e| {
684687 warn("Unable to parse target '{}': {}\n", .{ triple, @errorName(e) });
685 process.exit(1);
688 self.markInvalidUserInput();
689 return args.default_target;
686690 },
687691 };
688692
......@@ -703,9 +707,8 @@ pub const Builder = struct {
703707 const t_triple = t.zigTriple(self.allocator) catch unreachable;
704708 warn(" {}\n", .{t_triple});
705709 }
706 // TODO instead of process exit, return error and have a zig build flag implemented by
707 // the build runner that turns process exits into error return traces
708 process.exit(1);
710 self.markInvalidUserInput();
711 return args.default_target;
709712 }
710713
711714 return selected_target;