The pump thread reads from its own dup of the PTY master, so dropping the handle on close never closed the last master descriptor. The child got only the close signal (TERM by default) and no hangup; an interactive shell ignores TERM and kept running, with its pump thread parked forever. The reader now also polls a close-on-exec pipe whose write end lives in the handle. Dropping the handle wakes the reader, the pump drops the master dup before waiting, and the kernel hangs up the terminal. Co-authored-by: Grok Bot <grok-bot@users.noreply.github.com>
2 files changedLine totals unavailable