diff options
author | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2017-01-03 15:58:35 -0300 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2017-01-03 16:24:19 -0300 |
commit | f24e22446bd60b41d5125d384c5a637ddb46538f (patch) | |
tree | 7feae80a19bc12219094c25a81d4eef00b37f12b | |
parent | f6d0636466d04c92a43ec53cbe767a50ff27b352 (diff) |
validate: Properly kill subprocesses on windows
-rw-r--r-- | validate/launcher/baseclasses.py | 5 | ||||
-rw-r--r-- | validate/launcher/utils.py | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index bfb7dd4dff..c223c1cea0 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -339,7 +339,10 @@ class Test(Loggable): while res is None: try: self.debug("Subprocess is still alive, sending KILL signal") - self.process.send_signal(signal.SIGKILL) + if utils.is_windows(): + subprocess.call(['taskkill', '/F', '/T', '/PID', str(self.process.pid)]) + else: + self.process.send_signal(signal.SIGKILL) time.sleep(1) except OSError: pass diff --git a/validate/launcher/utils.py b/validate/launcher/utils.py index 20b3fd2dc0..b09b9001fb 100644 --- a/validate/launcher/utils.py +++ b/validate/launcher/utils.py @@ -24,6 +24,7 @@ except ImportError: from . import config import os +import platform import re import shutil import subprocess @@ -159,6 +160,11 @@ def path2url(path): return urllib.parse.urljoin('file:', urllib.request.pathname2url(path)) +def is_windows(): + platname = platform.system().lower() + return platname == 'windows' or 'mingw' in platname + + def url2path(url): path = urllib.parse.urlparse(url).path if "win32" in sys.platform: |