Status: add 'processes' command, the multiprocessing equivalent of the threads command.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
Daniel Folkinshteyn 2010-08-05 13:54:54 -04:00 committed by James McCoy
parent 7f98aa7105
commit 7f4a1be9f9
2 changed files with 14 additions and 0 deletions

View File

@ -94,6 +94,18 @@ class Status(callbacks.Plugin):
irc.reply(s)
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):
"""takes no arguments

View File

@ -71,6 +71,8 @@ class StatusTestCase(PluginTestCase):
def testThreads(self):
self.assertNotError('threads')
def testProcesses(self):
self.assertNotError('processes')
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: