validate: Properly kill subprocesses on windows

This commit is contained in:
Thibault Saunier 2017-01-03 15:58:35 -03:00
parent f6d0636466
commit f24e22446b
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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: