fix: add explicit UTF-8 encoding to _op_whoami subprocess call (#53428)
PR #55339 adds encoding='utf-8', errors='replace' to 26 subprocess.run(text=True) call sites across the codebase. The triage review (thanks @alt-glitch) diffed this PR against #55339 and found that 5 of the 6 originally-touched call sites are already covered there byte-identically: - hermes_cli/main.py::_probe_container - hermes_cli/setup.py SSH probe - tools/tts_tool.py::_generate_neutts - tools/transcription_tools.py::_prepare_local_audio - tools/transcription_tools.py::_transcribe_local_command (both branches) The one genuinely net-new site — hermes_cli/onepassword_secrets_cli.py::_op_whoami (the 1Password op CLI whoami probe) — is NOT in #55339 and is fixed here. Without explicit encoding=, text=True decodes child output with locale.getpreferredencoding(False) — cp936 on Chinese Windows — which crashes _readerthread on non-GBK bytes, cascading into pipe buffer fills, event loop stalls, and TUI freezes (issues #47939, #53428, #57238). Scope narrowed per triage feedback: the other 5 sites should land via #55339. Refs #53428 (together with #55339).
This commit is contained in:
@@ -514,7 +514,8 @@ def _op_whoami(
|
||||
env["OP_SERVICE_ACCOUNT_TOKEN"] = token_value
|
||||
try:
|
||||
res = subprocess.run(
|
||||
cmd, env=env, capture_output=True, text=True, timeout=10
|
||||
cmd, env=env, capture_output=True, text=True,
|
||||
encoding="utf-8", errors="replace", timeout=10
|
||||
)
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user