fix native OS version detection on macOS

closes #4583
This commit is contained in:
Andrew Kelley 2020-03-01 01:17:50 -05:00
parent 2246812184
commit f082e253b5

View File

@ -232,7 +232,7 @@ pub const NativeTargetInfo = struct {
// supports // supports
std.os.sysctlbynameC( std.os.sysctlbynameC(
"kern.osproductversion", "kern.osproductversion",
&product_version[0], &product_version,
&size, &size,
null, null,
0, 0,
@ -241,7 +241,8 @@ pub const NativeTargetInfo = struct {
else => unreachable, 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.min = ver;
os.version_range.semver.max = ver; os.version_range.semver.max = ver;
} else |err| switch (err) { } else |err| switch (err) {