From 73eae64dda33af7b3fbc38c846373763b6ff7a8f Mon Sep 17 00:00:00 2001 From: Ace Data Cloud Dev Date: Mon, 13 Jul 2026 12:21:07 +0800 Subject: [PATCH] fix(channels): support Windows legacy consoles --- coding_bridge/channels_cli.py | 8 ++++---- tests/test_channels_cli.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/coding_bridge/channels_cli.py b/coding_bridge/channels_cli.py index 16b6124..7974614 100644 --- a/coding_bridge/channels_cli.py +++ b/coding_bridge/channels_cli.py @@ -261,10 +261,10 @@ async def _run() -> None: state = "ENABLED" if inst.enabled else "disabled" print(f"[{state}] wechat/{inst.instance_id}: {inst.base_url}") if not inst.enabled: - print(" → skipped (enabled=false)") + print(" -> skipped (enabled=false)") continue ok, msg = await _doctor_one(inst) - marker = "✓" if ok else "✗" + marker = "[OK]" if ok else "[FAIL]" print(f" {marker} {msg}") if not ok: all_ok = False @@ -272,10 +272,10 @@ async def _run() -> None: state = "ENABLED" if tg.enabled else "disabled" print(f"[{state}] telegram/{tg.instance_id}: {tg.api_base}") if not tg.enabled: - print(" → skipped (enabled=false)") + print(" -> skipped (enabled=false)") continue ok, msg = await _doctor_one_telegram(tg) - marker = "✓" if ok else "✗" + marker = "[OK]" if ok else "[FAIL]" print(f" {marker} {msg}") if not ok: all_ok = False diff --git a/tests/test_channels_cli.py b/tests/test_channels_cli.py index 50179c2..58bf6be 100644 --- a/tests/test_channels_cli.py +++ b/tests/test_channels_cli.py @@ -145,7 +145,8 @@ def handler(request: httpx.Request) -> httpx.Response: rc, out, err = _capture(lambda: channels_cli.cmd_channels_doctor(s)) assert rc == 0 assert "live" in out - assert "OK" in out + assert "[OK]" in out + out.encode("cp936") # Token value never appears in output assert "abc" not in out assert "abc" not in err @@ -181,7 +182,9 @@ def handler(request: httpx.Request) -> httpx.Response: rc, out, err = _capture(lambda: channels_cli.cmd_channels_doctor(s)) assert rc == 1 assert "rejected" in out + assert "[FAIL]" in out assert "401" in out + out.encode("cp936") # Token never leaked assert "wrong" not in out