handle ctrl-c

This commit is contained in:
Mark McGranaghan
2012-10-11 08:00:42 -07:00
parent e34108a8d1
commit deafc3a0bf
2 changed files with 16 additions and 7 deletions

View File

@@ -27,10 +27,10 @@ func main() {
fmt.Println("going")
}()
// Since our two goroutines are running asynchrously
// in separate goroutines now, execution immediatly
// falls through to here. This `Scanln` code requires
// that we press a key before the program exits.
// Our two goroutines are running asynchrously in
// separate goroutines now, so execution falls through
// to here. This `Scanln` code requires we press a key
// before the program exits.
var input string
fmt.Scanln(&input)
fmt.Println("done")