mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-14 22:49:23 +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.',
|
||||
(world.threadsSpawned, 'thread'), activeThreads)
|
||||
if self.registryValue('cpu.memory', target):
|
||||
mem = 'an unknown amount'
|
||||
mem = None
|
||||
pid = os.getpid()
|
||||
plat = sys.platform
|
||||
try:
|
||||
@ -180,8 +180,11 @@ class Status(callbacks.Plugin):
|
||||
mem = int(out.splitlines()[1])
|
||||
elif sys.platform.startswith('netbsd'):
|
||||
mem = int(os.stat('/proc/%s/mem' % pid)[7])
|
||||
response += format(_(' I\'m taking up %S of memory.'),
|
||||
mem*1024)
|
||||
if mem:
|
||||
response += format(_(' I\'m taking up %S of memory.'),
|
||||
mem*1024)
|
||||
else:
|
||||
response += _(' I\'m taking up an unknown amount of memory.')
|
||||
except Exception:
|
||||
self.log.exception('Uncaught exception in cpu.memory:')
|
||||
irc.reply(utils.str.normalizeWhitespace(response))
|
||||
|
Loading…
Reference in New Issue
Block a user