handle ctrl-c
This commit is contained in:
parent
e34108a8d1
commit
deafc3a0bf
@ -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")
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user