Skip to content

feat(pty): harden Unix PTY lifecycle #37

Description

@decode2

Preflight checks

  • I searched open and closed issues and found no duplicate.
  • I understand a maintainer must add status:approved before work begins or a pull request is opened.

Problem

Unix PTY sessions need deterministic lifecycle handling so shutdown cannot leave descendant process groups running, reader completion cannot lose trailing output, and interrupt delivery remains reliable during writer-lock races.

Proposed solution

Harden Unix-only PTY lifecycle behavior to treat terminal EOF consistently, flush trailing lossy UTF-8, preserve final output ordering, escalate process-group teardown from HUP through TERM to KILL when needed, and fall back to group SIGINT when the writer lock is contended. Add focused native Unix regression coverage for teardown and race behavior.

Affected area

Terminal and PTY

Alternatives considered

Relying only on the PTY master close or signaling only the session leader does not guarantee descendant cleanup. Blocking indefinitely on the writer lock can also prevent timely interrupt delivery.

Additional context

Scope is limited to Unix lifecycle, process-group teardown, final-output ordering, and interrupt races. Windows implementation changes, WSL-specific behavior, desktop integration, and later platform work are intentionally excluded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:approvedApproved by a maintainer for implementationstatus:needs-reviewAwaiting maintainer review and approvaltype:featureAdds or improves functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions