Term sourcery again
This commit is contained in:
1
go.mod
1
go.mod
@@ -5,6 +5,7 @@ go 1.24.0
|
||||
require (
|
||||
github.com/creack/pty/v2 v2.0.1
|
||||
golang.org/x/crypto v0.43.0
|
||||
golang.org/x/term v0.37.0
|
||||
)
|
||||
|
||||
require golang.org/x/sys v0.37.0 // indirect
|
||||
|
||||
4
main.go
4
main.go
@@ -11,6 +11,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/term"
|
||||
"github.com/creack/pty/v2"
|
||||
)
|
||||
|
||||
@@ -148,6 +149,9 @@ func handleChannel(channel ssh.Channel, requests <-chan *ssh.Request) {
|
||||
log.Println("PTY start error:", err)
|
||||
return
|
||||
}
|
||||
if err := term.MakeRaw(int(ptmx.Fd())); err != nil {
|
||||
log.Println("MakeRaw master error:", err)
|
||||
}
|
||||
go func() {
|
||||
defer ptmx.Close()
|
||||
go io.Copy(channel, ptmx)
|
||||
|
||||
Reference in New Issue
Block a user