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:
teknium1 2026-07-24 10:05:18 -07:00 committed by Teknium
parent 051217342b
commit d4b867cf9f
28 changed files with 138 additions and 136 deletions

View file

@ -115,7 +115,7 @@ def _git_show(ref: str, path: str, repo_root: str) -> str | None:
proc = subprocess.run(
["git", "show", f"{ref}:{path}"],
capture_output=True,
text=True,
text=True, encoding="utf-8", errors="replace",
cwd=repo_root,
)
return proc.stdout if proc.returncode == 0 else None
@ -125,7 +125,7 @@ def _tracked_lockfiles(ref: str, repo_root: str) -> set[str]:
proc = subprocess.run(
["git", "ls-tree", "-r", "--name-only", ref],
capture_output=True,
text=True,
text=True, encoding="utf-8", errors="replace",
cwd=repo_root,
check=True,
)

View file

@ -246,7 +246,7 @@ def upload_evidence(
],
check=True,
capture_output=True,
text=True,
text=True, encoding="utf-8", errors="replace",
env=environment,
)
except subprocess.CalledProcessError as exc:

View file

@ -178,7 +178,7 @@ class ScratchDashboard:
]
self.proc = subprocess.Popen(
cmd, cwd=str(REPO_ROOT), env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, encoding="utf-8", errors="replace", bufsize=1,
)
threading.Thread(target=self._drain, args=(self.proc.stdout,), name="dash-log", daemon=True).start()
if not self._ready.wait(timeout=90.0):

View file

@ -2097,7 +2097,7 @@ def git(*args, cwd=None):
"""Run a git command and return stdout."""
result = subprocess.run(
["git"] + list(args),
capture_output=True, text=True,
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=cwd or str(REPO_ROOT),
)
if result.returncode != 0:
@ -2111,7 +2111,7 @@ def git_result(*args, cwd=None):
return subprocess.run(
["git"] + list(args),
capture_output=True,
text=True,
text=True, encoding="utf-8", errors="replace",
cwd=cwd or str(REPO_ROOT),
)
@ -2591,7 +2591,7 @@ def main():
if gh_bin:
result = subprocess.run(
gh_cmd,
capture_output=True, text=True,
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=str(REPO_ROOT),
)
else:

View file

@ -314,7 +314,7 @@ def _run_one_file_once(
cwd=repo_root,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
text=True, encoding="utf-8", errors="replace",
env=os.environ,
# POSIX: place the child at the head of its own process group so
# _kill_tree can SIGKILL the group atomically.