mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 02:02:32 +03:00
psutil.AccessDenied: psutil.AccessDenied (pid=1) #539
This commit is contained in:
parent
25efd90924
commit
59da647247
@ -294,12 +294,13 @@ def key_exist_value_not_none(k, d):
|
|||||||
return k in d and d[k] is not None
|
return k in d and d[k] is not None
|
||||||
|
|
||||||
|
|
||||||
def key_exist_value_not_none_not_v(k, d, v=''):
|
def key_exist_value_not_none_not_v(k, d, value='', lengh=None):
|
||||||
# Return True if:
|
# Return True if:
|
||||||
# - key k exists
|
# - key k exists
|
||||||
# - d[k] is not None
|
# - d[k] is not None
|
||||||
# - d[k] != v
|
# - d[k] != value
|
||||||
return k in d and d[k] is not None and d[k] != v
|
# - if lengh is not None and len(d[k]) >= lengh
|
||||||
|
return k in d and d[k] is not None and d[k] != value and (lengh is None or len(d[k]) >= lengh)
|
||||||
|
|
||||||
|
|
||||||
def disable(class_name, var):
|
def disable(class_name, var):
|
||||||
|
@ -222,7 +222,7 @@ class Plugin(GlancesPlugin):
|
|||||||
|
|
||||||
def _get_process_curses_vms(self, p, selected, args):
|
def _get_process_curses_vms(self, p, selected, args):
|
||||||
"""Return process VMS curses"""
|
"""Return process VMS curses"""
|
||||||
if key_exist_value_not_none_not_v('memory_info', p, ''):
|
if key_exist_value_not_none_not_v('memory_info', p, '', 1):
|
||||||
msg = self.layout_stat['virt'].format(self.auto_unit(p['memory_info'][1], low_precision=False))
|
msg = self.layout_stat['virt'].format(self.auto_unit(p['memory_info'][1], low_precision=False))
|
||||||
ret = self.curse_add_line(msg, optional=True)
|
ret = self.curse_add_line(msg, optional=True)
|
||||||
else:
|
else:
|
||||||
@ -232,7 +232,7 @@ class Plugin(GlancesPlugin):
|
|||||||
|
|
||||||
def _get_process_curses_rss(self, p, selected, args):
|
def _get_process_curses_rss(self, p, selected, args):
|
||||||
"""Return process RSS curses"""
|
"""Return process RSS curses"""
|
||||||
if key_exist_value_not_none_not_v('memory_info', p, ''):
|
if key_exist_value_not_none_not_v('memory_info', p, '', 0):
|
||||||
msg = self.layout_stat['res'].format(self.auto_unit(p['memory_info'][0], low_precision=False))
|
msg = self.layout_stat['res'].format(self.auto_unit(p['memory_info'][0], low_precision=False))
|
||||||
ret = self.curse_add_line(msg, optional=True)
|
ret = self.curse_add_line(msg, optional=True)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user