github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/testpty/pty.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package testpty is a simple pseudo-terminal package for Unix systems, 6 // implemented by calling C functions via cgo. 7 package testpty 8 9 import ( 10 "github.com/shogo82148/std/errors" 11 "github.com/shogo82148/std/os" 12 ) 13 14 type PtyError struct { 15 FuncName string 16 ErrorString string 17 Errno error 18 } 19 20 func (e *PtyError) Error() string 21 22 func (e *PtyError) Unwrap() error 23 24 var ErrNotSupported = errors.New("testpty.Open not implemented on this platform") 25 26 // Open returns a control pty and the name of the linked process tty. 27 // 28 // If Open is not implemented on this platform, it returns ErrNotSupported. 29 func Open() (pty *os.File, processTTY string, err error)