修复部分linux获取发行版错误的问题

This commit is contained in:
远野千束 2024-10-06 04:35:07 +08:00
parent 8e2c5c24b8
commit 9160e7c4b4

View File

@ -19,9 +19,9 @@ try:
# 找到NAME=和VERSION=的行
for line in os_release.split("\n"):
if line.startswith("NAME="):
os_name = line.split("=")[1]
os_name = line.split("=")[1].replace('"', '')
elif line.startswith("VERSION="):
os_version = line.split("=")[1]
os_version = line.split("=")[1].replace('"', '')
except FileNotFoundError:
os_name = platform.system()
os_version = platform.release()