1
Fork 0

Fix sigtermTime race.

If twisted notices that a process dies between when SIGTERM is sent,
then RunProcess.process.pid will be None, causing checkDead to fail.

In any case, the timer will be leaked, and it will be cancelled after having
been called.
This commit is contained in:
Tom Prince 2015-03-18 08:12:45 -06:00
parent 9f558c1d79
commit 1f4a3f3298
1 changed files with 3 additions and 0 deletions

View File

@ -780,6 +780,8 @@ class RunProcess:
self.kill(msg)
def isDead(self):
if self.process.pid is None:
return True
pid = int(self.process.pid)
try:
os.kill(pid, 0)
@ -788,6 +790,7 @@ class RunProcess:
return False # alive
def checkProcess(self):
self.sigtermTimer = None
if not self.isDead():
hit = self.sendSig(self.interruptSignal)
else: