peerstore: fix
[oweals/gnunet.git] / contrib / gnunet_janitor.py.in
index 056ab9bc4ae161cc093ad7e49f954eb837cfa47c..69186fde6d1052f110f58daf8306ae50ccdd35ef 100644 (file)
@@ -30,13 +30,11 @@ import sys
 import shutil
 import time
 import signal
+import terminate
 
 if os.name == 'nt':
   from win32com.client import GetObject
   WMI = GetObject('winmgmts:')
-  killsignal = signal.SIGTERM # any valid value will result in TerminateProcess()
-else:
-  killsignal = signal.SIGKILL  
 
 def get_process_list ():
   result = []
@@ -63,7 +61,7 @@ def main ():
     if re.match (r'gnunet-service-arm', p[1]):
       print ("killing arm process {0:5} {1}".format (p[0], p[1]))
       try:
-        os.kill (int (p[0]), killsignal)
+        terminate.safe_terminate_process_by_pid (int (p[0]), 1)
       except OSError as e:
         print ("failed: {0}".format (e))
         pass
@@ -71,7 +69,7 @@ def main ():
     if not re.match (r'gnunet-service-arm', p[1]):
       print ("killing non-arm process {0:5} {1}".format (p[0], p[1]))
       try:
-        os.kill (int (p[0]), killsignal)
+        terminate.safe_terminate_process_by_pid (int (p[0]), 1)
       except OSError as e:
         print ("failed: {0}".format (e))
         pass