Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
Handle wraps a PTY-backed process. File/Cmd are exported for existing callers, but Close can run concurrently with a blocked Read/Write in the PTY read-loop goroutine (that's how "Close unblocks readers immediately" works — closing the fd out from under a blocking Read is intentional), so every access to the fields themselves goes through mu.
Read/Write only hold mu for the pointer capture, then call the os.File method unlocked — safe because os.File's Read/Write/Close are themselves mutually synchronized via the runtime's internal poll.FD refcounting. SetSize is different: it goes through creack/pty's Setsize, which calls File.Fd() — and Fd() explicitly bypasses that poll.FD protection (per the os.File docs), so it's not safe against a concurrent Close at the OS level. SetSize and the Close side that actually closes the fd both hold mu for their whole call, not just the pointer swap, to cover that gap.