fix process names with spaces breaking column count
This commit is contained in:
parent
08f2101623
commit
44e7b0b2cf
|
@ -4,6 +4,7 @@ import re
|
||||||
KTHREADD_PID = 2
|
KTHREADD_PID = 2
|
||||||
PAT_UID = re.compile(r'Uid:\s+(?P<uid>[0-9]+)\s')
|
PAT_UID = re.compile(r'Uid:\s+(?P<uid>[0-9]+)\s')
|
||||||
PAT_GID = re.compile(r'Gid:\s+(?P<gid>[0-9]+)\s')
|
PAT_GID = re.compile(r'Gid:\s+(?P<gid>[0-9]+)\s')
|
||||||
|
PAT_REMOVE_PROC_SPACES = re.compile(r'(\([^\)]+\))')
|
||||||
|
|
||||||
def procs():
|
def procs():
|
||||||
|
|
||||||
|
@ -36,7 +37,10 @@ def procs():
|
||||||
with open(f, "r") as statfile:
|
with open(f, "r") as statfile:
|
||||||
with open(f+"us", "r") as statusfile:
|
with open(f+"us", "r") as statusfile:
|
||||||
# Read stat info
|
# Read stat info
|
||||||
stat = statfile.read().strip().split(" ")
|
stat = statfile.read().strip()
|
||||||
|
# Fix spaces in process names
|
||||||
|
stat = PAT_REMOVE_PROC_SPACES.sub("PROCNAME", stat)
|
||||||
|
stat = stat.split(" ")
|
||||||
|
|
||||||
# Read uid/gid from status
|
# Read uid/gid from status
|
||||||
status = statusfile.read()
|
status = statusfile.read()
|
||||||
|
|
Loading…
Reference in New Issue