...
1
2
3
4
5
6
7 package testpty
8
9 import (
10 "errors"
11 "fmt"
12 "os"
13 )
14
15 type PtyError struct {
16 FuncName string
17 ErrorString string
18 Errno error
19 }
20
21 func ptyError(name string, err error) *PtyError {
22 return &PtyError{name, err.Error(), err}
23 }
24
25 func (e *PtyError) Error() string {
26 return fmt.Sprintf("%s: %s", e.FuncName, e.ErrorString)
27 }
28
29 func (e *PtyError) Unwrap() error { return e.Errno }
30
31 var ErrNotSupported = errors.New("testpty.Open not implemented on this platform")
32
33
34
35
36 func Open() (pty *os.File, processTTY string, err error) {
37 return open()
38 }
39
View as plain text