Skip to content

Verify open_pty() TIOCSCTTY controlling-TTY behavior on macOS #3

Done

Description

@tony

Summary

libvt.aio.open_pty() acquires a controlling pseudo-terminal in an isolated child trampoline via fcntl.ioctl(0, termios.TIOCSCTTY, 0) so /dev/tty, os.tcgetpgrp(0), SIGWINCH on resize, and SIGINT on 0x03 work without subprocess preexec_fn (#2). Automated CI in .github/workflows/tests.yml at 7a72ae8 runs exclusively on ubuntu-latest, leaving Darwin (macos-latest) pty.openpty() and BSD TIOCSCTTY semantics unverified in CI.

Motivation

Linux and Darwin/BSD kernels differ on pseudo-terminal session leadership, TIOCSCTTY ioctl argument handling, and master-side EOF (EIO vs 0-byte read) when the slave descriptor closes. At the same time, GitHub Actions macos-latest runners have higher queue latency, stricter concurrency limits, and slower process-spawn timing that make running PTY signal tests on every pull-request matrix leg costly. Verification on macOS is therefore deferred out of the regular Linux PR gate and tracked separately for future opt-in or scheduled coverage.

Proposal

Invariants

The invariants below are load-bearing; everything under Intent is open.

  • Standard pull-request CI remains fast and Linux-only (ubuntu-latest) rather than gating routine commits on macos-latest runner availability.
  • open_pty() continues to acquire a controlling terminal (TIOCSCTTY), deliver SIGWINCH and SIGINT, reset SIGPIPE to SIG_DFL, and propagate execvp OSError failures without preexec_fn.

Intent (non-binding)

  • Add a manual (workflow_dispatch), release-only, or scheduled macos-latest workflow job exercising tests/test_aio_and_pytest.py (/dev/tty, os.tcgetpgrp(0), PtySession.resize() SIGWINCH, 0x03 SIGINT, and slave-close EOF handling) when macOS CI capacity is worth spending.
  • Confirm whether Darwin's pty.openpty() + fcntl.ioctl(0, termios.TIOCSCTTY, 0) requires any BSD-specific OSError handling on slave teardown in PtySession._on_readable.

Not doing

  • Adding macos-latest to the per-push Python 3.12–3.15 pull-request test matrix in .github/workflows/tests.yml.
  • Adding Windows ConPTY dependencies (pywinpty), which would break libvt's zero-dependency py3-none-any.whl contract.

References

Activity

  1. added
    enhancement
    on Nov 21, 2026
  2. tony commented on Nov 23, 2026

    @tony
    MemberAuthor

    Scope refinement for 0.1.0

    Pre-0.1.0 verification adds a single-Python macos-latest PTY job alongside a windows-latest portable-core job in .github/workflows/tests.yml so Darwin TIOCSCTTY, 1,024-byte TTYHOG write queueing (#24), and drain-until-EIO behavior on fast-exiting children are exercised directly in CI before tagging 0.1.0a0.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions