refactor: replace try-except blocks with contextlib.suppress for cleaner error handling across multiple files

This commit is contained in:
Jack Lu
2026-05-01 19:30:11 +08:00
committed by Xubin Ren
parent 1c24f10236
commit d9800ecdd2
27 changed files with 98 additions and 195 deletions
+3 -3
View File
@@ -5,6 +5,7 @@ import os
import re
import shutil
import sys
from contextlib import suppress
from pathlib import Path
from typing import Any
@@ -212,9 +213,8 @@ class ExecTool(Tool):
"""Kill a subprocess and reap it to prevent zombies."""
process.kill()
try:
await asyncio.wait_for(process.wait(), timeout=5.0)
except asyncio.TimeoutError:
pass
with suppress(asyncio.TimeoutError):
await asyncio.wait_for(process.wait(), timeout=5.0)
finally:
if not _IS_WINDOWS:
try: