40 lines
668 B
Go
40 lines
668 B
Go
/*
|
|
* Copyright (c) 2025, Антон Аксенов
|
|
* This file is part of iptvc project
|
|
* MIT License: https://git.axenov.dev/IPTV/iptvc/src/branch/master/LICENSE
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"axenov/iptv-checker/app"
|
|
"axenov/iptv-checker/cmd"
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
var version string
|
|
|
|
func main() {
|
|
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()
|
|
}
|