b95dd6a380
Change-Id: Ifa8cc0e4abb798c63c9d4ac9297e3e32443125e4 Implements: blueprint auth-controller-framework Signed-off-by: mozhuli <21621232@zju.edu.cn>
26 lines
462 B
Go
26 lines
462 B
Go
// +build !solaris
|
|
|
|
package gopass
|
|
|
|
import "golang.org/x/crypto/ssh/terminal"
|
|
|
|
type terminalState struct {
|
|
state *terminal.State
|
|
}
|
|
|
|
func isTerminal(fd uintptr) bool {
|
|
return terminal.IsTerminal(int(fd))
|
|
}
|
|
|
|
func makeRaw(fd uintptr) (*terminalState, error) {
|
|
state, err := terminal.MakeRaw(int(fd))
|
|
|
|
return &terminalState{
|
|
state: state,
|
|
}, err
|
|
}
|
|
|
|
func restore(fd uintptr, oldState *terminalState) error {
|
|
return terminal.Restore(int(fd), oldState.state)
|
|
}
|