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 {...@@ -653,7 +653,8 @@ pub const Builder = struct {
653 for (diags.arch.?.allCpuModels()) |cpu| {653 for (diags.arch.?.allCpuModels()) |cpu| {
654 warn(" {}\n", .{cpu.name});654 warn(" {}\n", .{cpu.name});
655 }655 }
656 process.exit(1);656 self.markInvalidUserInput();
657 return args.default_target;
657 },658 },
658 error.UnknownCpuFeature => {659 error.UnknownCpuFeature => {
659 warn(660 warn(
...@@ -667,7 +668,8 @@ pub const Builder = struct {...@@ -667,7 +668,8 @@ pub const Builder = struct {
667 for (diags.arch.?.allFeaturesList()) |feature| {668 for (diags.arch.?.allFeaturesList()) |feature| {
668 warn(" {}: {}\n", .{ feature.name, feature.description });669 warn(" {}: {}\n", .{ feature.name, feature.description });
669 }670 }
670 process.exit(1);671 self.markInvalidUserInput();
672 return args.default_target;
671 },673 },
672 error.UnknownOperatingSystem => {674 error.UnknownOperatingSystem => {
673 warn(675 warn(
...@@ -678,11 +680,13 @@ pub const Builder = struct {...@@ -678,11 +680,13 @@ pub const Builder = struct {
678 inline for (std.meta.fields(std.Target.Os.Tag)) |field| {680 inline for (std.meta.fields(std.Target.Os.Tag)) |field| {
679 warn(" {}\n", .{field.name});681 warn(" {}\n", .{field.name});
680 }682 }
681 process.exit(1);683 self.markInvalidUserInput();
684 return args.default_target;
682 },685 },
683 else => |e| {686 else => |e| {
684 warn("Unable to parse target '{}': {}\n", .{ triple, @errorName(e) });687 warn("Unable to parse target '{}': {}\n", .{ triple, @errorName(e) });
685 process.exit(1);688 self.markInvalidUserInput();
689 return args.default_target;
686 },690 },
687 };691 };
688692
...@@ -703,9 +707,8 @@ pub const Builder = struct {...@@ -703,9 +707,8 @@ pub const Builder = struct {
703 const t_triple = t.zigTriple(self.allocator) catch unreachable;707 const t_triple = t.zigTriple(self.allocator) catch unreachable;
704 warn(" {}\n", .{t_triple});708 warn(" {}\n", .{t_triple});
705 }709 }
706 // TODO instead of process exit, return error and have a zig build flag implemented by710 self.markInvalidUserInput();
707 // the build runner that turns process exits into error return traces711 return args.default_target;
708 process.exit(1);
709 }712 }
710713
711 return selected_target;714 return selected_target;