mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(windows): sweep remaining unguarded text-mode subprocess sites codebase-wide
AST-driven pass over every subprocess.run/Popen/check_output/check_call/call with text=True (or universal_newlines=True) and no explicit encoding=: append encoding='utf-8', errors='replace' at the kwarg site. 136 call sites across 28 files (cli.py, hermes_cli/main.py, tools_config.py, environments, computer_use, gateway, scripts, skills helpers, agent/*). Together with the salvaged #55339/#60741 commits this closes out issue #53428's bug class; the salvaged #60751 linter rule in check-windows-footguns.py now enforces it repo-wide (verified: 807 files scanned, zero findings).
This commit is contained in:
parent
051217342b
commit
d4b867cf9f
28 changed files with 138 additions and 136 deletions
|
|
@ -362,7 +362,7 @@ def _resolve_direct_interpreter(python_entry: str) -> tuple[str, list[str]]:
|
|||
"print(json.dumps({'base':getattr(sys,'_base_executable','') or sys.executable,"
|
||||
"'path':[p for p in sys.path if p],'root':root}))"
|
||||
)
|
||||
out = subprocess.run([python_entry, "-c", query], capture_output=True, text=True, timeout=30)
|
||||
out = subprocess.run([python_entry, "-c", query], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=30)
|
||||
if out.returncode != 0:
|
||||
raise ValueError("could not resolve the base Python interpreter")
|
||||
info = json.loads(out.stdout.strip().splitlines()[-1])
|
||||
|
|
@ -437,8 +437,8 @@ def inspect_hermes(hermes_path: str) -> dict[str, Any]:
|
|||
path = os.path.abspath(hermes_path)
|
||||
if not os.path.isabs(hermes_path) or not os.path.isfile(path):
|
||||
raise ValueError("Hermes path is not an executable file")
|
||||
version = subprocess.run([path, "--version"], capture_output=True, text=True, timeout=20)
|
||||
help_result = subprocess.run([path, "serve", "--help"], capture_output=True, text=True, timeout=20)
|
||||
version = subprocess.run([path, "--version"], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=20)
|
||||
help_result = subprocess.run([path, "serve", "--help"], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=20)
|
||||
help_text = help_result.stdout + help_result.stderr
|
||||
return {
|
||||
"path": path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue