Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4257cd3668 |
@ -62,11 +62,6 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
|
||||||
<-cmd.Context().Done()
|
|
||||||
log.Fatal(cmd.Context().Err().Error())
|
|
||||||
}()
|
|
||||||
|
|
||||||
switch opt.Cfg.Args.Type {
|
switch opt.Cfg.Args.Type {
|
||||||
case "data":
|
case "data":
|
||||||
return core.RunData(cmd, input, output)
|
return core.RunData(cmd, input, output)
|
||||||
|
@ -72,7 +72,7 @@ func RunData(cmd *cobra.Command, input, output model.IO[map[string]any]) error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Dump: dump data success = %d", wroteCount)
|
log.Info("Dump: dump data success = %d total = %d", wroteCount, total)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -119,7 +119,7 @@ func RunData(cmd *cobra.Command, input, output model.IO[map[string]any]) error {
|
|||||||
|
|
||||||
wc.Wait()
|
wc.Wait()
|
||||||
|
|
||||||
log.Info("Dump: dump data success, total = %d", total)
|
log.Info("Dump: dump all data success, total = %d", total)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
5
main.go
5
main.go
@ -14,6 +14,11 @@ func main() {
|
|||||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
log.Fatal(ctx.Err().Error())
|
||||||
|
}()
|
||||||
|
|
||||||
if err := cmd.Run(ctx); err != nil {
|
if err := cmd.Run(ctx); err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user