Merge branch 'fix/find_and_close_service_in_ot_ci_case' into 'master'

fix(ci): optimize an openthread ci case

Closes IDFCI-2430

See merge request espressif/esp-idf!34106
This commit is contained in:
Shu Chen
2024-11-14 11:58:23 +08:00

View File

@ -410,12 +410,15 @@ def host_publish_service() -> None:
def host_close_service() -> None:
command = "ps | grep avahi-publish-s | awk '{print $1}'"
command = 'ps aux | grep avahi-publish-s'
out_bytes = subprocess.check_output(command, shell=True, timeout=5)
out_str = out_bytes.decode('utf-8')
the_pid = re.findall(r'(\d+)\n', str(out_str))
for pid in the_pid:
service_info = [line for line in out_str.splitlines() if 'testxxx _testxxx._udp' in line]
for line in service_info:
print('Process:', line)
pid = line.split()[1]
command = 'kill -9 ' + pid
print('kill ', pid)
subprocess.call(command, shell=True, timeout=5)
time.sleep(1)