mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-24 03:50:14 +10:00
utilities.py: Add error handling in check_boot_mode()
This commit is contained in:
@@ -610,8 +610,11 @@ def block_os_updaters():
|
|||||||
|
|
||||||
def check_boot_mode():
|
def check_boot_mode():
|
||||||
# Check whether we're in Safe Mode or not
|
# Check whether we're in Safe Mode or not
|
||||||
|
try:
|
||||||
sys_plist = plistlib.loads(subprocess.run(["system_profiler", "SPSoftwareDataType"], stdout=subprocess.PIPE).stdout)
|
sys_plist = plistlib.loads(subprocess.run(["system_profiler", "SPSoftwareDataType"], stdout=subprocess.PIPE).stdout)
|
||||||
return sys_plist[0]["_items"][0]["boot_mode"]
|
return sys_plist[0]["_items"][0]["boot_mode"]
|
||||||
|
except (KeyError, TypeError, plistlib.InvalidFileException):
|
||||||
|
return None
|
||||||
|
|
||||||
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
|
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
|
||||||
# When running through our GUI, we run as root, however we do not get uid 0
|
# When running through our GUI, we run as root, however we do not get uid 0
|
||||||
|
|||||||
Reference in New Issue
Block a user