fix: Windows encoding + .cmd subprocess resolution (#64) (#66)

- Replace text=True with encoding='utf-8', errors='replace' in all
  subprocess.run calls (channels + cli.py) to fix GBK decode errors
  on Chinese Windows systems
- Use shutil.which() resolved paths in channel subprocess calls to
  handle Windows .cmd wrappers (npm global installs)

Co-authored-by: Panniantong <panniantong@users.noreply.github.com>
This commit is contained in:
Pnant
2026-03-04 17:30:11 +08:00
committed by GitHub
parent 7434c3cb9f
commit a91a74d880
8 changed files with 45 additions and 33 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ class TwitterChannel(Channel):
)
try:
r = subprocess.run(
[xreach, "auth", "check"], capture_output=True, text=True, timeout=10
[xreach, "auth", "check"], capture_output=True,
encoding="utf-8", errors="replace", timeout=10
)
if r.returncode == 0:
return "ok", "完整可用(读取、搜索推文)"