moved deadline method to FdHolder

This commit is contained in:
photostorm
2023-10-28 18:00:10 -04:00
parent 96e45d8b5a
commit 7f5c495d24
2 changed files with 5 additions and 6 deletions

3
doc.go
View File

@@ -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
}

View File

@@ -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 {