avoid empty lines when parsing os-release

This commit is contained in:
Blake Harnden 2020-07-10 10:39:14 -07:00
parent 9b7dce0861
commit 38e6838697

View file

@ -42,6 +42,8 @@ def get_os() -> OsInfo:
with open("/etc/os-release", "r") as f: with open("/etc/os-release", "r") as f:
for line in f.readlines(): for line in f.readlines():
line = line.strip() line = line.strip()
if not line:
continue
key, value = line.split("=") key, value = line.split("=")
d[key] = value.strip('"') d[key] = value.strip('"')
name_value = d["ID"] name_value = d["ID"]