Skip to content

Commit

Permalink
moved deadline method to FdHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
photostorm committed Oct 28, 2023
1 parent 96e45d8 commit 7f5c495
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand All @@ -47,7 +47,6 @@ type Tty interface {
FdHolder

Name() string
SetDeadline(t time.Time) error // TODO: Maybe move to FdHolder?

io.ReadWriteCloser
}
8 changes: 4 additions & 4 deletions pty_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
// the kernel32.dll is loaded from windows system path.
//
// Ref: https://pkg.go.dev/[email protected]?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")
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 7f5c495

Please sign in to comment.