Skip to content

Commit

Permalink
fix: implement fd
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed May 2, 2024
1 parent 854cddf commit 491acf7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ type Session interface {
// of whether or not a PTY was accepted for this session.
Pty() (Pty, <-chan Window, bool)

Fd() uintptr

// Signals registers a channel to receive signals sent from the client. The
// channel must handle signal sends or it will block the SSH request loop.
// Registering nil will unregister the channel from signal sends. During the
Expand Down Expand Up @@ -140,6 +142,13 @@ func (sess *session) Stderr() io.ReadWriter {
return sess.Channel.Stderr()
}

func (sess *session) Fd() uintptr {
if sess.pty != nil && sess.EmulatedPty() {
return sess.pty.Slave.Fd()

Check failure on line 147 in session.go

View workflow job for this annotation

GitHub Actions / build / build (windows-latest)

sess.pty.Slave undefined (type *Pty has no field or method Slave)

Check failure on line 147 in session.go

View workflow job for this annotation

GitHub Actions / build / build (windows-latest)

sess.pty.Slave undefined (type *Pty has no field or method Slave)
}
return 0
}

func (sess *session) Write(p []byte) (int, error) {
if sess.pty != nil && sess.EmulatedPty() {
return NewPtyWriter(sess.Channel).Write(p)
Expand Down

0 comments on commit 491acf7

Please sign in to comment.