From ec59d71e6083cdddfd0092dfbdd62d5077ba0633 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 17 Feb 2026 03:14:47 -0800 Subject: [PATCH] Update PTY write handling in ProcessRegistry to ensure data is encoded as bytes before writing. This change improves compatibility with string inputs and clarifies the expected data type in comments. --- tools/process_registry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/process_registry.py b/tools/process_registry.py index 5f135ffa9..443cbc508 100644 --- a/tools/process_registry.py +++ b/tools/process_registry.py @@ -538,10 +538,11 @@ class ProcessRegistry: if session.exited: return {"status": "already_exited", "error": "Process has already finished"} - # PTY mode -- write through pty handle + # PTY mode -- write through pty handle (expects bytes) if hasattr(session, '_pty') and session._pty: try: - session._pty.write(data) + pty_data = data.encode("utf-8") if isinstance(data, str) else data + session._pty.write(pty_data) return {"status": "ok", "bytes_written": len(data)} except Exception as e: return {"status": "error", "error": str(e)}