]> git.llucax.com Git - software/pymin.git/blobdiff - pymin/procman.py
Make some procman.ProcessManager's methods return the ProcessInfo instance.
[software/pymin.git] / pymin / procman.py
index 554fdbada88629222e889b77d6b01b180caeab63..87e3282224e8266e109a39e3c822bd8a20539908 100644 (file)
@@ -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)