1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 10:10:46 +00:00

cgroups: fix Controller.tasks()

Fix cgroups tasks parsing in Controller.tasks() method, to ignore lines
that are not formatted properly.
This commit is contained in:
Douglas Raillard 2018-03-12 15:50:45 +00:00 committed by Marc Bonnici
parent e3d9c4b2fd
commit f515420387

View File

@ -210,7 +210,15 @@ class Controller(object):
entries = output.splitlines()
tasks = {}
for task in entries:
tid_str, tname, tcmdline = task.split(',', 2)
fields = task.split(',', 2)
nr_fields = len(fields)
if nr_fields < 2:
continue
elif nr_fields == 2:
tid_str, tname = fields
tcmdline = ''
else:
tid_str, tname, tcmdline = fields
if not re.search(filter_tid, tid_str):
continue