summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2015-12-28 16:50:40 -0500
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2015-12-28 16:50:40 -0500
commitd5510db2d57fea4263a8ca7a8bc3dcff88df310a (patch)
tree719b5cfa2c08ec26c89e63bec43be9d18a4a69ff
parent0f825e855c65bde8d3f5b7ad1b046088949cc914 (diff)
downloadmongo-d5510db2d57fea4263a8ca7a8bc3dcff88df310a.tar.gz
SERVER-21875 Support self-termination of hang analyzer on Windows.
-rwxr-xr-xbuildscripts/hang_analyzer.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/buildscripts/hang_analyzer.py b/buildscripts/hang_analyzer.py
index 1d5f8c4772d..338c6c96446 100755
--- a/buildscripts/hang_analyzer.py
+++ b/buildscripts/hang_analyzer.py
@@ -25,6 +25,9 @@ import time
from distutils import spawn
from optparse import OptionParser
+if sys.platform == "win32":
+ import win32process
+
def call(a = []):
sys.stdout.write(str(a) + "\n")
sys.stdout.flush()
@@ -354,7 +357,13 @@ def signal_process(pid):
def timeout_protector():
print "Script timeout has been hit, terminating"
- os.kill(os.getpid(), signal.SIGKILL)
+ if sys.platform == "win32":
+ # Have the process exit with code 9 when it terminates itself to closely match the exit code
+ # of the process when it sends itself a SIGKILL.
+ handle = win32process.GetCurrentProcess()
+ win32process.TerminateProcess(handle, 9)
+ else:
+ os.kill(os.getpid(), signal.SIGKILL)
# Basic procedure