(p, p_name)
| 14 | stderr=subprocess.STDOUT) |
| 15 | |
| 16 | def kill_proc(p, p_name): |
| 17 | nonlocal timed_out |
| 18 | if p.poll() is None: |
| 19 | p.terminate() |
| 20 | timed_out = True |
| 21 | logging.error( |
| 22 | "Process {} terminated due to timeout".format(p_name)) |
| 23 | |
| 24 | p_name = subprocess.list2cmdline(cmd_list) |
| 25 | timer = threading.Timer(timeout_secs, kill_proc, [proc, p_name]) |