diff options
Diffstat (limited to 'exit.go')
| -rw-r--r-- | exit.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -17,6 +17,9 @@ import ( func (pb *Auto) GoodExit(msg string) { go ExitWatchdog() + if myAuto.appExit != nil { + myAuto.appExit() + } dur := time.Since(pb.Ctime.AsTime()) log.Infof("%s: %s (%s)\n", pb.Argname, msg, config.FormatDuration(dur)) os.Exit(0) @@ -24,6 +27,9 @@ func (pb *Auto) GoodExit(msg string) { func (pb *Auto) BadExit(msg string, err error) { go ExitWatchdog() + if myAuto.appExit != nil { + myAuto.appExit() + } if err != nil { log.Info(err) } @@ -34,7 +40,7 @@ func (pb *Auto) BadExit(msg string, err error) { // this code doesn't need to be this complicated. I put it here as reference code for myself so I could remember where it is. func ExitWatchdog() { - dog := time.NewTicker(time.Second) + dog := time.NewTicker(5 * time.Second) defer dog.Stop() dogchan := make(chan bool) /* |
