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