commit:     1c5666dd6ae518dfd88409d248fdcc7fd4298b68
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 10 12:56:42 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 10 12:56:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=1c5666dd

grs/Interpret.py: more aggressively send TERM/KILL signals.

 grs/Interpret.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index bea0bf2..4749561 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -4,6 +4,8 @@ import os
 import re
 import signal
 import sys
+import time
+
 from grs.Constants import CONST
 from grs.Daemon import Daemon
 from grs.Log import Log
@@ -44,8 +46,12 @@ class Interpret(Daemon):
                         if mypid == pid:
                             continue
                         try:
-                            os.kill(pid, signal.SIGTERM)
-                            os.kill(pid, signal.SIGKILL)
+                            for i in range(10):
+                                os.kill(pid, signal.SIGTERM)
+                                time.sleep(0.2)
+                            while True:
+                                os.kill(pid, signal.SIGKILL)
+                                time.sleep(0.2)
                         except ProcessLookupError:
                             pass
             try:

Reply via email to