2024-03-22 18:05:47 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
2025-02-05 18:07:53 +08:00
|
|
|
"github.com/loveuer/esgo2dump/pkg/log"
|
2024-12-13 15:01:40 +08:00
|
|
|
|
2024-03-26 17:23:10 +08:00
|
|
|
"github.com/loveuer/esgo2dump/internal/cmd"
|
2024-03-22 18:05:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
|
|
|
defer cancel()
|
|
|
|
|
2025-02-05 18:07:53 +08:00
|
|
|
go func() {
|
|
|
|
<-ctx.Done()
|
|
|
|
log.Fatal(ctx.Err().Error())
|
|
|
|
}()
|
|
|
|
|
|
|
|
if err := cmd.Run(ctx); err != nil {
|
2024-05-10 21:40:02 +08:00
|
|
|
log.Error(err.Error())
|
2024-03-22 18:05:47 +08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|