wip2
This commit is contained in:
26
main.go
26
main.go
@@ -7,9 +7,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"axenov/iptv-checker/app"
|
||||
"axenov/iptv-checker/cmd"
|
||||
"context"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var version string
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
app.SetVersion(version)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-sigCh
|
||||
cancel()
|
||||
app.Shutdown()
|
||||
os.Exit(130)
|
||||
}()
|
||||
|
||||
if err := cmd.ExecuteContext(ctx); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
app.Shutdown()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user