Simplification in the goroutine that restore the terminal state on SIGINT

Upstream-commit: b306a6073882e7995d74801d77d7baca4b12ec86
Component: engine
This commit is contained in:
Louis Opter
2013-04-03 16:32:47 -07:00
parent 7815b9b259
commit e262b369bb

View File

@ -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
}