-
Notifications
You must be signed in to change notification settings - Fork 0
feat(pty): harden Unix PTY lifecycle #37
Copy link
Copy link
Closed
Labels
status:approvedApproved by a maintainer for implementationApproved by a maintainer for implementationstatus:needs-reviewAwaiting maintainer review and approvalAwaiting maintainer review and approvaltype:featureAdds or improves functionalityAdds or improves functionality
Description
Metadata
Metadata
Assignees
Labels
status:approvedApproved by a maintainer for implementationApproved by a maintainer for implementationstatus:needs-reviewAwaiting maintainer review and approvalAwaiting maintainer review and approvaltype:featureAdds or improves functionalityAdds or improves functionality
Preflight checks
status:approvedbefore 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.