diff options
author | LRN <LRN@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-07-12 21:06:27 +0000 |
---|---|---|
committer | LRN <LRN@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-07-12 21:06:27 +0000 |
commit | aa944191bfd0ef0d45cafdaaab656965b7cada96 (patch) | |
tree | aa0550b801e72a39899d2a6340a796ec7417083b /contrib | |
parent | 1e55ae6bd5de30b70b966e64724f3b20428edb91 (diff) |
W32: safer process termination
git-svn-id: https://gnunet.org/svn/gnunet@22623 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/Makefile.am | 2 | ||||
-rw-r--r-- | contrib/gnunet_janitor.py.in | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 0d65393308..aaab287a84 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -13,6 +13,7 @@ timeout_watchdog_SOURCES = \ endif noinst_SCRIPTS = \ + terminate.py \ gnunet_pyexpect.py \ gnunet_janitor.py @@ -28,6 +29,7 @@ EXTRA_DIST = \ hostlist.cgi \ hostlist.php \ report.sh \ + terminate.py.in \ gnunet_pyexpect.py.in \ gnunet_janitor.py.in \ gnunet-gns-import.sh diff --git a/contrib/gnunet_janitor.py.in b/contrib/gnunet_janitor.py.in index 056ab9bc4a..69186fde6d 100644 --- a/contrib/gnunet_janitor.py.in +++ b/contrib/gnunet_janitor.py.in @@ -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 |