forked from creack/pty
-
Notifications
You must be signed in to change notification settings - Fork 14
/
doc.go
56 lines (44 loc) · 1.34 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Package pty provides functions for working with Unix terminals.
package pty
import (
"errors"
"io"
"time"
)
// ErrUnsupported is returned if a function is not
// available on the current platform.
var ErrUnsupported = errors.New("unsupported")
// Open a pty and its corresponding tty.
func Open() (Pty, Tty, error) {
return open()
}
// FdHolder surfaces the Fd() method of the underlying handle.
type FdHolder interface {
Fd() uintptr
}
// DeadlineHolder surfaces the SetDeadline() method to sets the read and write deadlines.
type DeadlineHolder interface {
SetDeadline(t time.Time) error
}
// Pty for terminal control in current process.
//
// - For Unix systems, the real type is *os.File.
// - For Windows, the real type is a *WindowsPty for ConPTY handle.
type Pty interface {
// FdHolder is intended to resize / control ioctls of the TTY of the child process in current process.
FdHolder
Name() string
// WriteString is only used to identify Pty and Tty.
WriteString(s string) (n int, err error)
io.ReadWriteCloser
}
// Tty for data I/O in child process.
//
// - For Unix systems, the real type is *os.File.
// - For Windows, the real type is a *WindowsTty, which is a combination of two pipe file.
type Tty interface {
// FdHolder Fd only intended for manual InheritSize from Pty.
FdHolder
Name() string
io.ReadWriteCloser
}