fix: add explicit UTF-8 encoding to all subprocess text=True calls (#53428)
On Windows with Chinese locale (GBK), subprocess.run(text=True) without explicit encoding causes UnicodeDecodeError crashes. This fix adds encoding='utf-8', errors='replace' to all subprocess.run() and subprocess.Popen() calls that use text=True across 76 non-test Python files. Fixes #53428 (master tracker for Windows GBK locale crash). Note: credential_pool.py and electron changes excluded per reviewer request — those will be submitted as separate focused PRs.
This commit is contained in:
@@ -147,7 +147,7 @@ def _try_gh_cli_token() -> Optional[str]:
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
text=True, encoding='utf-8', errors='replace',
|
||||
timeout=5,
|
||||
env=clean_env,
|
||||
**_popen_kwargs,
|
||||
|
||||
Reference in New Issue
Block a user