mirror of
https://github.com/creack/pty.git
synced 2026-04-01 02:57:06 +09:00
moved deadline method to FdHolder
This commit is contained in:
3
doc.go
3
doc.go
@@ -19,6 +19,7 @@ func Open() (Pty, Tty, error) {
|
||||
// FdHolder surfaces the Fd() method of the underlying handle.
|
||||
type FdHolder interface {
|
||||
Fd() uintptr
|
||||
SetDeadline(t time.Time) error
|
||||
}
|
||||
|
||||
// Pty for terminal control in current process.
|
||||
@@ -33,7 +34,6 @@ type Pty interface {
|
||||
|
||||
// WriteString is only used to identify Pty and Tty.
|
||||
WriteString(s string) (n int, err error)
|
||||
SetDeadline(t time.Time) error // TODO: Maybe move to FdHolder?
|
||||
|
||||
io.ReadWriteCloser
|
||||
}
|
||||
@@ -47,7 +47,6 @@ type Tty interface {
|
||||
FdHolder
|
||||
|
||||
Name() string
|
||||
SetDeadline(t time.Time) error // TODO: Maybe move to FdHolder?
|
||||
|
||||
io.ReadWriteCloser
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ var (
|
||||
// the kernel32.dll is loaded from windows system path.
|
||||
//
|
||||
// Ref: https://pkg.go.dev/syscall@go1.13?GOOS=windows#LoadDLL
|
||||
kernel32DLL = windows.NewLazyDLL("kernel32.dll")
|
||||
kernel32DLL = windows.NewLazySystemDLL("kernel32.dll")
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/console/createpseudoconsole
|
||||
createPseudoConsole = kernel32DLL.NewProc("CreatePseudoConsole")
|
||||
@@ -138,8 +138,8 @@ func (p *WindowsPty) Close() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *WindowsPty) SetDeadline(value time.Time) error {
|
||||
return nil
|
||||
func (p *WindowsPty) SetDeadline(value time.Time) error {
|
||||
return os.ErrNoDeadline
|
||||
}
|
||||
|
||||
func (t *WindowsTty) Name() string {
|
||||
@@ -164,7 +164,7 @@ func (t *WindowsTty) Close() error {
|
||||
}
|
||||
|
||||
func (t *WindowsTty) SetDeadline(value time.Time) error {
|
||||
return nil
|
||||
return os.ErrNoDeadline
|
||||
}
|
||||
|
||||
func procCreatePseudoConsole(hInput windows.Handle, hOutput windows.Handle, dwFlags uint32, consoleHandle *windows.Handle) error {
|
||||
|
||||
Reference in New Issue
Block a user