summaryrefslogtreecommitdiff
path: root/exit.go
diff options
context:
space:
mode:
Diffstat (limited to 'exit.go')
-rw-r--r--exit.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/exit.go b/exit.go
index 5a6c5a1..6643b64 100644
--- a/exit.go
+++ b/exit.go
@@ -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)
/*