diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-15 12:44:29 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-15 12:44:29 -0300 |
commit | 806a6247b9ef180105ed1e34cb4ad48bab712385 (patch) | |
tree | d0d2a58faae57344ef79fd6767cb74b0725033e1 | |
parent | 2c94fc3e4a80850b1d5342091917702b33944448 (diff) | |
download | python-linux-procfs-806a6247b9ef180105ed1e34cb4ad48bab712385.tar.gz |
pidstat: Support COMM names with spaces
The load method was just splitting the fields using space as the
separator, but since some COMM names started having spaces... We
better use the () as the COMM "quotes", using spaces as the
separator for the remaining fields.
Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | procfs/procfs.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py index 6b4fd84..0ed55af 100755 --- a/procfs/procfs.py +++ b/procfs/procfs.py @@ -100,8 +100,9 @@ class pidstat: def load(self, basedir = "/proc"): f = open("%s/%d/stat" % (basedir, self.pid)) - fields = f.readline().strip().split() + fields = f.readline().strip().split(') ') f.close() + fields = fields[0].split(' (') + fields[1].split() self.fields = {} nr_fields = min(len(fields), len(self.proc_stat_fields)) for i in range(nr_fields): |