Improve meminfo parse logic

This commit is contained in:
Thaynã Moretti 2020-08-30 12:28:48 -03:00
parent 820598b1b8
commit 6f6f3cedd9

View file

@ -72,12 +72,7 @@ class Module(core.module.Module):
data = {} data = {}
with open("/proc/meminfo", "r") as f: with open("/proc/meminfo", "r") as f:
# https://bugs.python.org/issue32933 # https://bugs.python.org/issue32933
while True: for line in f.readlines():
line = f.readline()
if line == '':
break
tmp = re.split(r"[:\s]+", line) tmp = re.split(r"[:\s]+", line)
value = int(tmp[1]) value = int(tmp[1])
if tmp[2] == "kB": if tmp[2] == "kB":