Skip to content

ttysnap: Windows ConPTY backend for the shared pty module (deferred) #535

Description

@fentas

Follow-on from the ttysnap arc. The shared pty module (src/ttysnap/pty.zig) is POSIX-only: it uses posix_openpt/grantpt/unlockpt/ptsname/fork/execvpe + TIOCSCTTY/dup2. To drive terminal programs on Windows, ttysnap (and by extension the e2e harness once converged) needs a ConPTY backend.

Sketch:

  • Add a Windows branch to pty.spawn (or a pty_windows.zig selected by @import("builtin").os.tag): CreatePseudoConsole (ConPTY) + CreateProcessW with PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, returning the read/write pipe handles in place of the master fd.
  • Child abstracts the handle vs fd; setSize → ResizePseudoConsole.
  • The pump (poll/non-blocking read) needs a Windows equivalent (overlapped I/O or a reader thread).

Deferred deliberately: cannot be built/runtime-tested on the Linux dev box (no way to verify ConPTY behavior), so it would land unverified. Pick up when a Windows test path exists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions