diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-05-15 19:56:05 -0400 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-05-15 19:56:05 -0400 |
| commit | 38dabc5f10a657cb4cab360958b9926936663628 (patch) | |
| tree | cf2bd71e8e2cddbac840b5e1f7f7e6b77bfceb5e /psutil/_pslinux.py | |
| parent | f5c2ac689d3e31e1386dc7b1fb149b9c66357120 (diff) | |
| download | psutil-38dabc5f10a657cb4cab360958b9926936663628.tar.gz | |
fir unpackment err
Diffstat (limited to 'psutil/_pslinux.py')
| -rw-r--r-- | psutil/_pslinux.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 79a62638..9e4ae764 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1123,6 +1123,8 @@ class Process(object): # /proc/self/smaps on the other hand appears to give us the # correct information. smaps_data = self._read_smaps_file() + # Note: smaps file can be empty for certain processes. + # The code below will not crash though and will result to 0. uss = sum(map(int, _private_re.findall(smaps_data))) * 1024 pss = sum(map(int, _pss_re.findall(smaps_data))) * 1024 swap = sum(map(int, _swap_re.findall(smaps_data))) * 1024 @@ -1160,10 +1162,10 @@ class Process(object): yield (current_block.pop(), data) data = self._read_smaps_file() - lines = data.split('\n') - # smaps file can be empty - if not lines: + # Note: smaps file can be empty for certain processes. + if not data: return [] + lines = data.split('\n') ls = [] first_line = lines.pop(0) current_block = [first_line] |
