mirror of
https://github.com/creack/pty.git
synced 2026-03-31 18:47:10 +09:00
README: replace deprecated crypto/ssh/terminal (#108)
The golang.org/x/crypto/ssh/terminal package was deprecated in favor of golang.org/x/term. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
GitHub
parent
a6c0a376f1
commit
097644e6ac
@@ -14,10 +14,11 @@ Pty is a Go package for using unix pseudo-terminals.
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/creack/pty"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/creack/pty"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -51,7 +52,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/creack/pty"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
func test() error {
|
||||
@@ -79,11 +80,11 @@ func test() error {
|
||||
ch <- syscall.SIGWINCH // Initial resize.
|
||||
|
||||
// Set stdin in raw mode.
|
||||
oldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))
|
||||
oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.
|
||||
defer func() { _ = term.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.
|
||||
|
||||
// Copy stdin to the pty and the pty to stdout.
|
||||
go func() { _, _ = io.Copy(ptmx, os.Stdin) }()
|
||||
|
||||
Reference in New Issue
Block a user