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:
@@ -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"):
|
||||||
|
|||||||
Reference in New Issue
Block a user