|
@ -9,6 +9,7 @@ import ( |
|
|
func TrapSignal(cb func()) { |
|
|
func TrapSignal(cb func()) { |
|
|
c := make(chan os.Signal, 1) |
|
|
c := make(chan os.Signal, 1) |
|
|
signal.Notify(c, os.Interrupt) |
|
|
signal.Notify(c, os.Interrupt) |
|
|
|
|
|
signal.Notify(c, os.Kill) |
|
|
go func() { |
|
|
go func() { |
|
|
for sig := range c { |
|
|
for sig := range c { |
|
|
fmt.Printf("captured %v, exiting...\n", sig) |
|
|
fmt.Printf("captured %v, exiting...\n", sig) |
|
|