mirror of
https://github.com/pnx/pinger.git
synced 2026-06-16 03:24:54 +02:00
Print signal when received
This commit is contained in:
parent
ede1205501
commit
e7c49dac1c
1 changed files with 2 additions and 1 deletions
3
main.go
3
main.go
|
|
@ -34,7 +34,8 @@ func eventLoop(pinger *probing.Pinger) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
// Got signal. stop pinger and exit goroutine
|
// Got signal. stop pinger and exit goroutine
|
||||||
case <-sig:
|
case s := <-sig:
|
||||||
|
fmt.Printf("Recived signal: %s, exiting.", s)
|
||||||
return
|
return
|
||||||
// Ticker ticks. print stats.
|
// Ticker ticks. print stats.
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue