Skip to content

Commit 0437680

Browse files
authored
Explain pty Process abstraction (coder#3254)
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent 6230d55 commit 0437680

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pty/pty.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ type PTY interface {
2929
Resize(height uint16, width uint16) error
3030
}
3131

32-
// Process represents a process running in a PTY
32+
// Process represents a process running in a PTY. We need to trigger special processing on the PTY
33+
// on process completion, meaning that we will have goroutines calling Wait() on the process. Since
34+
// the caller will also typically wait for the process, and it is not safe for multiple goroutines
35+
// to Wait() on a process, this abstraction provides a goroutine-safe interface for interacting with
36+
// the process.
3337
type Process interface {
3438

3539
// Wait for the command to complete. Returned error is as for exec.Cmd.Wait()

0 commit comments

Comments
 (0)