20 lines
259 B
Go
20 lines
259 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"golang.org/x/term"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func goRaw() (*term.State, error) {
|
||
|
return term.MakeRaw(int(os.Stdin.Fd()))
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
oldState, err := goRaw()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
defer term.Restore(int(os.Stdin.Fd()), oldState)
|
||
|
}
|