def stop(hcitool, hcidump):
# import psutil here so as long as all implementations are in the same file, all will work
import psutil
log.info('Stop receiving broadcasts')
def kill_child_processes(parent_pid):
try:
parent = psutil.Process(parent_pid)
except psutil.NoSuchProcess:
return
for process in parent.children(recursive=True):
subprocess.call(['sudo', '-n', 'kill', '-s', 'SIGINT', str(process.pid)])
kill_child_processes(hcitool.pid)
subprocess.call(['sudo', '-n', 'kill', '-s', 'SIGINT', str(hcitool.pid)])
kill_child_processes(hcidump.pid)
subprocess.call(['sudo', '-n', 'kill', '-s', 'SIGINT', str(hcidump.pid)])
评论列表
文章目录