mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-03 02:33:53 +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()
|
stime = time.time()
|
||||||
res = process.poll()
|
res = process.poll()
|
||||||
waittime = 0.05
|
waittime = 0.05
|
||||||
|
killsig = None
|
||||||
|
if not is_windows():
|
||||||
|
killsig = signal.SIGINT
|
||||||
while res is None:
|
while res is None:
|
||||||
try:
|
try:
|
||||||
owner.debug("Subprocess is still alive, sending KILL signal")
|
owner.debug("Subprocess is still alive, sending KILL signal")
|
||||||
|
@ -577,15 +580,19 @@ def kill_subprocess(owner, process, timeout):
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
['taskkill', '/F', '/T', '/PID', str(process.pid)])
|
['taskkill', '/F', '/T', '/PID', str(process.pid)])
|
||||||
else:
|
else:
|
||||||
process.send_signal(signal.SIGKILL)
|
process.send_signal(killsig)
|
||||||
time.sleep(waittime)
|
time.sleep(waittime)
|
||||||
waittime *= 2
|
waittime *= 2
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
if time.time() - stime > DEFAULT_TIMEOUT:
|
if not is_windows() and time.time() - stime > timeout / 4:
|
||||||
raise RuntimeError("Could not kill subprocess after %s second"
|
killsig = signal.SIGKILL
|
||||||
" Something is really wrong, => EXITING"
|
if time.time() - stime > timeout:
|
||||||
% DEFAULT_TIMEOUT)
|
printc("Could not kill %s subprocess after %s second"
|
||||||
|
" Something is really wrong, => EXITING"
|
||||||
|
% (owner, timeout), Colors.FAIL)
|
||||||
|
|
||||||
|
return
|
||||||
res = process.poll()
|
res = process.poll()
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in a new issue