fix: harden subprocess output decoding across lessons

This commit is contained in:
Haoran
2026-08-26 01:05:16 +08:00
parent 3e17b98504
commit cce031e632
34 changed files with 178 additions and 75 deletions

View File

@@ -70,7 +70,7 @@ def execute_tool(name: str, args: dict) -> str:
try:
r = subprocess.run(
args["command"], shell=True, cwd=WORKDIR,
capture_output=True, text=True, timeout=60
capture_output=True, text=True, errors="replace", timeout=60
)
return (r.stdout + r.stderr).strip() or "(empty)"
except subprocess.TimeoutExpired:

View File

@@ -168,7 +168,7 @@ def run_bash(command: str) -> str:
shell=True,
cwd=WORKDIR,
capture_output=True,
text=True,
text=True, errors="replace",
timeout=60
)
output = (result.stdout + result.stderr).strip()