diff options
| author | Jeff Carr <[email protected]> | 2025-10-12 00:56:11 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-12 00:56:11 -0500 |
| commit | 07eccc7f591fca0914a94782f4b5c8ba973d14d1 (patch) | |
| tree | b7d8e1c14cd4f44e26d0a12b698852796b78e93b /exit.go | |
| parent | 9ad9c25bd36643e954fe0a3a1e5a2ba3ec92151b (diff) | |
Exit() callback
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) /* |
