X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/bdc7c3f6286c768cf683b78dfb5576c733121a8b..634129cba23f0d6986fb9c3e443b57d9c9ede201:/pymin/procman.py?ds=inline diff --git a/pymin/procman.py b/pymin/procman.py index 0330e23..5cea4d4 100644 --- a/pymin/procman.py +++ b/pymin/procman.py @@ -86,6 +86,15 @@ class ProcessManager: assert name in self.namemap self.namemap[name].stop() + def restart(self, name): + logging.debug(u'ProcessManager.restart(%s)', name) + if name in self.namemap: + self.namemap[name].stop() + self.namemap[name].wait() + self.namemap[name].restart() + else: + self.namemap[name].start() + def kill(self, name, signum): assert name in self.namemap self.namemap[name].kill(name, stop) @@ -131,7 +140,7 @@ class ProcessManager: else: # is a pid if name in self.pidmap: return self.pidmap[name] - return KeyError, name + raise KeyError, name def has(self, name): if isinstance(name, basestring): # is a name