MCPcopy Index your code
hub / github.com/coder/coder / control

Method control

pty/pty_other.go:62–89  ·  view source on GitHub ↗
(tty *os.File, fn func(fd uintptr) error)

Source from the content-addressed store, hash-verified

60}
61
62func (p *otherPty) control(tty *os.File, fn func(fd uintptr) error) (err error) {
63 defer func() {
64 // Always echo the close error for closed ptys.
65 p.mutex.Lock()
66 defer p.mutex.Unlock()
67 if p.closed {
68 err = p.err
69 }
70 }()
71
72 rawConn, err := tty.SyscallConn()
73 if err != nil {
74 return err
75 }
76
77 var ctlErr error
78 err = rawConn.Control(func(fd uintptr) {
79 ctlErr = fn(fd)
80 })
81 switch {
82 case err != nil:
83 return err
84 case ctlErr != nil:
85 return ctlErr
86 default:
87 return nil
88 }
89}
90
91func (p *otherPty) Name() string {
92 return p.name

Callers 3

EchoEnabledMethod · 0.95
newPtyFunction · 0.95
ResizeMethod · 0.95

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected