core/process: cross-platform PTY via backend and pywinpty

POSIX openpty/fork and Windows ConPTY; win32 marker dep plus typings stub.
This commit is contained in:
2026-07-15 20:01:43 +08:00
parent 611147b0a5
commit c466d09173
9 changed files with 496 additions and 182 deletions
+13
View File
@@ -246,12 +246,25 @@ async def test_pty_output_budget_is_per_session(workspace: object) -> None:
def test_pty_master_not_inheritable(workspace: object) -> None:
del workspace
import os
import sys
if sys.platform == "win32":
import pytest
pytest.skip("master FD inheritance is POSIX-only")
try:
opened = call_sync(open_pty, ["sleep", "5"])
session_id = _session_id(opened)
session = PtyManager.get(session_id)
assert session is not None
assert session.master_fd is not None
assert os.get_inheritable(session.master_fd) is False
finally:
PtyManager.close_all()
def test_pty_backend_available() -> None:
from plyngent.tools.process.pty_backend import pty_available
assert pty_available() is True