Merge pull request #301 from WorkHaH/fix-s02-output-decoding

Fixed the child process output decoding issue in the s02 tool call.
This commit is contained in:
gui-yue
2026-05-25 18:26:15 +08:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -51,7 +51,8 @@ def run_bash(command: str) -> str:
return "Error: Dangerous command blocked" return "Error: Dangerous command blocked"
try: try:
r = subprocess.run(command, shell=True, cwd=WORKDIR, r = subprocess.run(command, shell=True, cwd=WORKDIR,
capture_output=True, text=True, timeout=120) capture_output=True, text=True,
encoding="utf-8", errors="replace", timeout=120)
out = (r.stdout + r.stderr).strip() out = (r.stdout + r.stderr).strip()
return out[:50000] if out else "(no output)" return out[:50000] if out else "(no output)"
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:

View File

@@ -49,7 +49,8 @@ def run_bash(command: str) -> str:
return "Error: Dangerous command blocked" return "Error: Dangerous command blocked"
try: try:
r = subprocess.run(command, shell=True, cwd=WORKDIR, r = subprocess.run(command, shell=True, cwd=WORKDIR,
capture_output=True, text=True, timeout=120) capture_output=True, text=True,
encoding="utf-8", errors="replace", timeout=120)
out = (r.stdout + r.stderr).strip() out = (r.stdout + r.stderr).strip()
return out[:50000] if out else "(no output)" return out[:50000] if out else "(no output)"
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired: