mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Status: add 'processes' command, the multiprocessing equivalent of the threads command.
This commit is contained in:
parent
89cbc7efdf
commit
f55606cfb4
@ -93,6 +93,18 @@ class Status(callbacks.Plugin):
|
|||||||
(len(threads), 'thread'), len(threads), threads)
|
(len(threads), 'thread'), len(threads), threads)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
threads = wrap(threads)
|
threads = wrap(threads)
|
||||||
|
|
||||||
|
def processes(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns the number of processes that have been spawned.
|
||||||
|
"""
|
||||||
|
# TODO: maintain a dict of active subprocesses, so we can
|
||||||
|
# include a list thereof in output, linke in threads(). maybe?
|
||||||
|
s = format('I have spawned %n.',
|
||||||
|
(world.processesSpawned, 'process'))
|
||||||
|
irc.reply(s)
|
||||||
|
processes = wrap(processes)
|
||||||
|
|
||||||
def net(self, irc, msg, args):
|
def net(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
@ -71,6 +71,8 @@ class StatusTestCase(PluginTestCase):
|
|||||||
def testThreads(self):
|
def testThreads(self):
|
||||||
self.assertNotError('threads')
|
self.assertNotError('threads')
|
||||||
|
|
||||||
|
def testProcesses(self):
|
||||||
|
self.assertNotError('processes')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user