Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2021-09-06 13:40:45 +0000
committerGitHub <noreply@github.com>2021-09-06 13:40:45 +0000
commit8d7ccde1626afbf358e38caa2733aff554b51ea9 (patch)
treeb6c3695f097388a3ca5c8efc1195d113556dce83 /archinstall
parent5fe752cf7223cc9ff1cf1a50ad5f7873594f83c1 (diff)
Added exception handling to check_output
I tweaked the optimized return of check_output. Worth mentioning that `check_output()` will raise an exception `subprocess.CalledProcessError: Command 'lscpu | grep AMD' returned non-zero exit status 1.`.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/hardware.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index f38d46da..c64d21a9 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -63,13 +63,19 @@ def has_wifi() -> bool:
def has_amd_cpu() -> bool:
- if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
- return True
+ try:
+ return subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode()
+ except:
+ pass
return False
def has_intel_cpu() -> bool:
- return subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode()
+ try:
+ return subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode()
+ except:
+ pass
+ return False
def has_uefi() -> bool:
return os.path.isdir('/sys/firmware/efi')