fix(tui): handle Windows PTY stdin and detached WS frames
This commit is contained in:
@@ -1207,10 +1207,14 @@ class ProcessRegistry:
|
||||
if session.exited:
|
||||
return {"status": "already_exited", "error": "Process has already finished"}
|
||||
|
||||
# PTY mode -- write through pty handle (expects bytes)
|
||||
# PTY mode -- write through pty handle.
|
||||
if hasattr(session, '_pty') and session._pty:
|
||||
try:
|
||||
pty_data = data.encode("utf-8") if isinstance(data, str) else data
|
||||
# pywinpty expects str on Windows; ptyprocess expects bytes on POSIX.
|
||||
if _IS_WINDOWS:
|
||||
pty_data = data.decode("utf-8") if isinstance(data, bytes) else str(data)
|
||||
else:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user