forked from photostorm/pty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
46 lines (36 loc) · 1.06 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
// Package pty provides functions for working with Unix terminals.
package pty
import (
"errors"
"io"
)
// 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()
}
type FdHolder interface {
Fd() uintptr
}
// 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 Fd intended to resize Tty of 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
}