diff --git a/examples/goroutines/goroutines.go b/examples/goroutines/goroutines.go index 98cd466..f3539e8 100644 --- a/examples/goroutines/goroutines.go +++ b/examples/goroutines/goroutines.go @@ -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") diff --git a/tools/build-loop b/tools/build-loop index 0d69f7f..5384701 100755 --- a/tools/build-loop +++ b/tools/build-loop @@ -1,12 +1,21 @@ #!/bin/bash +TRAPPING=0 +trap "{ echo finishing; TRAPPING=1; }" SIGINT + while : do tools/build - if [ "$?" == "0" ]; then + RET=$? + if [ $RET -eq 0 ]; then echo "success" else - echo "error" + echo "error: $RET" + fi + if [ $TRAPPING -eq 0 ]; then + sleep 1 + else + echo "done" + exit 0 fi - sleep 1 done