mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
Tools: autotest: send SIGTERM to processes before killing them
This allows coverage atexit functions to run
This commit is contained in:
parent
552cc4be5c
commit
28c2179a97
@ -6,6 +6,7 @@ import os
|
||||
import random
|
||||
import re
|
||||
import shlex
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@ -165,6 +166,19 @@ def pexpect_close(p):
|
||||
"""Close a pexpect child."""
|
||||
global close_list
|
||||
|
||||
ex = None
|
||||
try:
|
||||
p.kill(signal.SIGTERM)
|
||||
except IOError as e:
|
||||
print("Caught exception: %s" % str(e))
|
||||
ex = e
|
||||
pass
|
||||
if ex is None:
|
||||
# give the process some time to go away
|
||||
for i in range(20):
|
||||
if not p.isalive():
|
||||
break
|
||||
time.sleep(0.05)
|
||||
try:
|
||||
p.close()
|
||||
except Exception:
|
||||
|
Loading…
Reference in New Issue
Block a user