mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Status: Fix output of @cpu if the amount of memory is unknown.
This commit is contained in:
parent
b0ee589702
commit
856d275697
@ -160,7 +160,7 @@ class Status(callbacks.Plugin):
|
|||||||
'running.',
|
'running.',
|
||||||
(world.threadsSpawned, 'thread'), activeThreads)
|
(world.threadsSpawned, 'thread'), activeThreads)
|
||||||
if self.registryValue('cpu.memory', target):
|
if self.registryValue('cpu.memory', target):
|
||||||
mem = 'an unknown amount'
|
mem = None
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
plat = sys.platform
|
plat = sys.platform
|
||||||
try:
|
try:
|
||||||
@ -180,8 +180,11 @@ class Status(callbacks.Plugin):
|
|||||||
mem = int(out.splitlines()[1])
|
mem = int(out.splitlines()[1])
|
||||||
elif sys.platform.startswith('netbsd'):
|
elif sys.platform.startswith('netbsd'):
|
||||||
mem = int(os.stat('/proc/%s/mem' % pid)[7])
|
mem = int(os.stat('/proc/%s/mem' % pid)[7])
|
||||||
|
if mem:
|
||||||
response += format(_(' I\'m taking up %S of memory.'),
|
response += format(_(' I\'m taking up %S of memory.'),
|
||||||
mem*1024)
|
mem*1024)
|
||||||
|
else:
|
||||||
|
response += _(' I\'m taking up an unknown amount of memory.')
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.exception('Uncaught exception in cpu.memory:')
|
self.log.exception('Uncaught exception in cpu.memory:')
|
||||||
irc.reply(utils.str.normalizeWhitespace(response))
|
irc.reply(utils.str.normalizeWhitespace(response))
|
||||||
|
Loading…
Reference in New Issue
Block a user