Clean up the target process and temporary file
(process, temp_file_path)
| 393 | |
| 394 | |
| 395 | def cleanup_process(process, temp_file_path): |
| 396 | """Clean up the target process and temporary file""" |
| 397 | with contextlib.suppress(Exception): |
| 398 | if process.poll() is None: |
| 399 | process.terminate() |
| 400 | try: |
| 401 | process.wait(timeout=5.0) |
| 402 | except subprocess.TimeoutExpired: |
| 403 | process.kill() |
| 404 | process.wait() |
| 405 | |
| 406 | |
| 407 | def main(): |