summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2019-03-21 17:10:25 -0300
committerThibault Saunier <tsaunier@gnome.org>2019-04-03 13:38:42 +0000
commit01aa026e5a3b6f8c5b25b7d6d7e0fdc7bcf4c77a (patch)
treeb16f501da85ee31ef498e6e6529e68d6b3e85c43
parent28d413f0598e87f218d1b88f0148f98621da014f (diff)
validate:launcher: Try to send SIGINT before killing processes
Giving a chance for validate to print reports
-rw-r--r--validate/launcher/utils.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/validate/launcher/utils.py b/validate/launcher/utils.py
index cfa1c85..7daf7bc 100644
--- a/validate/launcher/utils.py
+++ b/validate/launcher/utils.py
@@ -570,6 +570,9 @@ def kill_subprocess(owner, process, timeout):
stime = time.time()
res = process.poll()
waittime = 0.05
+ killsig = None
+ if not is_windows():
+ killsig = signal.SIGINT
while res is None:
try:
owner.debug("Subprocess is still alive, sending KILL signal")
@@ -577,15 +580,19 @@ def kill_subprocess(owner, process, timeout):
subprocess.call(
['taskkill', '/F', '/T', '/PID', str(process.pid)])
else:
- process.send_signal(signal.SIGKILL)
+ process.send_signal(killsig)
time.sleep(waittime)
waittime *= 2
except OSError:
pass
- if time.time() - stime > DEFAULT_TIMEOUT:
- raise RuntimeError("Could not kill subprocess after %s second"
- " Something is really wrong, => EXITING"
- % DEFAULT_TIMEOUT)
+ if not is_windows() and time.time() - stime > timeout / 4:
+ killsig = signal.SIGKILL
+ if time.time() - stime > timeout:
+ printc("Could not kill %s subprocess after %s second"
+ " Something is really wrong, => EXITING"
+ % (owner, timeout), Colors.FAIL)
+
+ return
res = process.poll()
return res