Skip to content

Commit

Permalink
macOS: catch removed Airport macOS 14.4+ issue
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jun 6, 2024
1 parent 8699af7 commit e87f811
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/mozloc/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import functools
import shutil
import subprocess


def running_as_root() -> bool:
Expand All @@ -17,11 +18,17 @@ def get_exe(name: str, path: str | None = None) -> str:


def get_airport() -> str:
return get_exe(
exe = get_exe(
"airport",
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources",
)

msg = subprocess.check_output(exe, text=True, timeout=10)
if "WARNING: The airport command line tool is deprecated" in msg:
raise EnvironmentError(msg)

return exe


def get_nmcli() -> str:
return get_exe("nmcli")
Expand Down

0 comments on commit e87f811

Please sign in to comment.