mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
validate:launcher: Try to send SIGINT before killing processes
Giving a chance for validate to print reports
This commit is contained in:
parent
28d413f059
commit
01aa026e5a
1 changed files with 12 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue