From 07eccc7f591fca0914a94782f4b5c8ba973d14d1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 12 Oct 2025 00:56:11 -0500 Subject: Exit() callback --- exit.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'exit.go') 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) /* -- cgit v1.2.3