1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Simplification in the goroutine that restore the terminal state on SIGINT

This commit is contained in:
Louis Opter 2013-04-03 16:32:47 -07:00
parent 7d0ab3858e
commit b306a60738

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
}