Skip to content

Commit

Permalink
Applied code suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Sep 6, 2023
1 parent a8e32d9 commit b7e4a39
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/cli/feedback/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"io"
"os"

"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

Expand All @@ -42,15 +41,15 @@ func InteractiveStreams() (io.Reader, io.Writer, error) {
return os.Stdin, stdOut, nil
}

var oldStateStdin *terminal.State
var oldStateStdin *term.State

// SetRawModeStdin sets the stdin stream in RAW mode (no buffering, echo disabled,
// no terminal escape codes nor signals interpreted)
func SetRawModeStdin() {
if oldStateStdin != nil {
panic("terminal already in RAW mode")
}
oldStateStdin, _ = terminal.MakeRaw(int(os.Stdin.Fd()))
oldStateStdin, _ = term.MakeRaw(int(os.Stdin.Fd()))
}

// RestoreModeStdin restore the terminal settings to the normal non-RAW state. This
Expand All @@ -60,7 +59,7 @@ func RestoreModeStdin() {
if oldStateStdin == nil {
return
}
_ = terminal.Restore(int(os.Stdin.Fd()), oldStateStdin)
_ = term.Restore(int(os.Stdin.Fd()), oldStateStdin)
oldStateStdin = nil
}

Expand Down

0 comments on commit b7e4a39

Please sign in to comment.