Skip to content

Commit

Permalink
fix native OS version detection on macOS
Browse files Browse the repository at this point in the history
closes #4583
  • Loading branch information
andrewrk committed Mar 1, 2020
1 parent 2246812 commit f082e25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/std/zig/system.zig
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub const NativeTargetInfo = struct {
// supports
std.os.sysctlbynameC(
"kern.osproductversion",
&product_version[0],
&product_version,
&size,
null,
0,
Expand All @@ -241,7 +241,8 @@ pub const NativeTargetInfo = struct {
else => unreachable,
};

if (std.builtin.Version.parse(product_version[0..size])) |ver| {
const string_version = product_version[0 .. size - 1 :0];
if (std.builtin.Version.parse(string_version)) |ver| {
os.version_range.semver.min = ver;
os.version_range.semver.max = ver;
} else |err| switch (err) {
Expand Down

0 comments on commit f082e25

Please sign in to comment.