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

This commit is contained in:
Daniel Folkinshteyn 2010-08-05 13:54:54 -04:00
parent 89cbc7efdf
commit f55606cfb4
2 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,18 @@ class Status(callbacks.Plugin):
(len(threads), 'thread'), len(threads), threads)
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: