nfflow/main.go

23 lines
494 B
Go
Raw Normal View History

2024-03-31 20:09:20 +08:00
package main
import (
"context"
"github.com/loveuer/nfflow/internal/cmd"
"github.com/loveuer/nfflow/internal/util"
"github.com/sirupsen/logrus"
"os/signal"
"syscall"
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
defer cancel()
if err := cmd.Execute(ctx); err != nil {
logrus.Errorf("cmd.Execute: err=%v", err)
}
logrus.Warn("received quit signal...(2s)")
<-util.Timeout(2).Done()
}