l.s.t.p.ProcessProtocolWithTwoStageKill(ProcessProtocol) : class documentation

Part of lp.services.twistedsupport.processmonitor View In Hierarchy

Known subclasses: lp.services.twistedsupport.processmonitor.ProcessMonitorProtocol

Support for interrupting, then killing if necessary, processes.
Instance Variables_clockA provider of Twisted's IReactorTime, to allow testing that does not depend on an external clock. If a clock is not explicitly supplied the reactor is used.
_sigkill_delayed_callWhen we are terminating a process, we send SIGINT, wait a while and then send SIGKILL if required. We stash the DelayedCall here so that it can be cancelled if the SIGINT causes the process to exit.
Method __init__ Construct an instance.
Method terminateProcess Terminate the process by SIGINT initially, but SIGKILL if needed.
Method processEnded See ProcessProtocol.processEnded.
Method _sigkill Forcefully kill the process.
def __init__(self, clock=None):
Construct an instance.
ParametersclockA provider of Twisted's IReactorTime. This parameter exists to allow testing that does not depend on an external clock. If a clock is not passed in explicitly the reactor is used.
def terminateProcess(self, timeout=None):
Terminate the process by SIGINT initially, but SIGKILL if needed.
ParameterstimeoutHow many seconds to wait after the SIGINT before sending the SIGKILL. If None, use self.default_wait_before_kill instead.
def _sigkill(self):
Forcefully kill the process.
def processEnded(self, reason):
See ProcessProtocol.processEnded.

If the process dies and we're waiting to SIGKILL it, we can stop waiting.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.