Function isSdkInstalled [src]

Check if SDK is installed on Darwin without triggering CLT installation popup window. Note: simply invoking xcrun will inevitably trigger the CLT installation popup. Therefore, we resort to invoking xcode-select --print-path and checking if the status is nonzero. stderr from xcode-select is ignored. If error.OutOfMemory occurs in Allocator, this function returns null.

Prototype

pub fn isSdkInstalled(allocator: Allocator) bool

Parameters

allocator: Allocator

Source

pub fn isSdkInstalled(allocator: Allocator) bool { const result = std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "xcode-select", "--print-path" }, }) catch return false; defer { allocator.free(result.stderr); allocator.free(result.stdout); } return switch (result.term) { .Exited => |code| if (code == 0) result.stdout.len > 0 else false, else => false, }; }