From: Leandro Lucarella Date: Tue, 20 May 2008 02:21:00 +0000 (-0300) Subject: Make some procman.ProcessManager's methods return the ProcessInfo instance. X-Git-Url: https://git.llucax.com/software/pymin.git/commitdiff_plain/ab490862207d7d09ae6b65c4b756bba0c4e9b4c3?ds=sidebyside;hp=1017502ba4bfa740fd73812f11feea2e3476e71d Make some procman.ProcessManager's methods return the ProcessInfo instance. Now registar(), unregister() and once() procman.ProcessManager's methods returns the ProcessInfo instance just created/removed. --- diff --git a/pymin/procman.py b/pymin/procman.py index 554fdba..87e3282 100644 --- a/pymin/procman.py +++ b/pymin/procman.py @@ -80,12 +80,16 @@ class ProcessManager: log.debug(u'ProcessManager.register(%s, %s, %s, %s, %s, %s, %s)', name, command, callback, persist, max_errors, args, kwargs) assert not self.has(name) - self.services[name] = ProcessInfo(name, command, callback, persist, - max_errors, args, kwargs) + pi = ProcessInfo(name, command, callback, persist, max_errors, + args, kwargs) + self.services[name] = pi + return pi def unregister(self, name): log.debug(u'ProcessManager.unregister(%s)', name) + pi = self.services[name] del self.services[name] + return pi def _call(self, pi): pi.start() @@ -99,6 +103,7 @@ class ProcessManager: pi = ProcessInfo(name, command, callback, persist, max_errors, args, kwargs) self._call(pi) + return pi def start(self, name): log.debug(u'ProcessManager.start(%s)', name)