Another catch for NoSuchProcess - Correct issue #414

This commit is contained in:
Nicolas Hennion 2014-10-28 08:58:43 +01:00
parent bc660feb2e
commit 0669dcb189

View File

@ -149,8 +149,12 @@ class GlancesProcesses(object):
procstat['mandatory_stats'] = True
# Process CPU, MEM percent and name
procstat.update(
proc.as_dict(attrs=['cpu_percent', 'memory_percent', 'name'], ad_value=''))
try:
procstat.update(
proc.as_dict(attrs=['cpu_percent', 'memory_percent', 'name'], ad_value=''))
except psutil.NoSuchProcess:
# Correct issue #414
return None
if procstat['cpu_percent'] == '' or procstat['memory_percent'] == '':
# Do not display process if we can not get the basic
# cpu_percent or memory_percent stats