fix: remove isatty guard in _ensure_utf8_console (#95) (#101)

The isatty() check skipped UTF-8 wrapping when agent-reach was called
as a subprocess by AI agents (non-TTY). On Windows with GBK encoding,
any remaining non-ASCII chars would crash with UnicodeEncodeError.

Now UTF-8 wrapping applies in all environments on Windows.

Closes #95

Co-authored-by: Panniantong <panniantong@users.noreply.github.com>
This commit is contained in:
Pnant 2026-03-07 12:58:18 +08:00 committed by GitHub
parent 8a90e52fde
commit 75a2213510
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,8 +25,6 @@ def _ensure_utf8_console():
# Avoid interfering with pytest/captured streams.
if os.environ.get("PYTEST_CURRENT_TEST"):
return
if not getattr(sys.stdout, "isatty", lambda: False)():
return
try:
import io
if hasattr(sys.stdout, "buffer"):