INNER CODE UNIT · Python
host_macos_major
viticci/shortcuts-playground-plugin · claude/skills/shortcuts-playground/scripts/lookup_action_grounding.py:143
def host_macos_major() -> int | None:
if platform.system() != "Darwin":
return None
try:
result = subprocess.run(
["sw_vers", "-productVersion"],
capture_output=True,
text=True,
timeout=2,
check=False,
)
except (OSError, subprocess.SubprocessError):
return None
if result.returncode != 0:
return None
major = result.stdout.strip().split(".", 1)[0]
return int(major) if major.isdigit() else None