Simplification in the goroutine that restore the terminal state on SIGINT
Upstream-commit: b306a6073882e7995d74801d77d7baca4b12ec86 Component: engine
This commit is contained in:
@ -65,11 +65,9 @@ func setRawTerminal() (*term.State, error) {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
go func() {
|
||||
for _ = range c {
|
||||
term.Restore(int(os.Stdin.Fd()), oldState)
|
||||
log.Printf("\nSIGINT received\n")
|
||||
os.Exit(0)
|
||||
}
|
||||
_ = <-c
|
||||
term.Restore(int(os.Stdin.Fd()), oldState)
|
||||
os.Exit(0)
|
||||
}()
|
||||
return oldState, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user