fixed graceful shutdown handling

This commit is contained in:
Gani Georgiev
2023-12-08 21:16:48 +02:00
parent d86e20b7f2
commit 506b759560
5 changed files with 35 additions and 13 deletions
+2 -1
View File
@@ -152,12 +152,13 @@ func (pb *PocketBase) Execute() error {
sigch := make(chan os.Signal, 1)
signal.Notify(sigch, os.Interrupt, syscall.SIGTERM)
<-sigch
done <- true
}()
// execute the root command
go func() {
// leave to the commands to decide whether to print their error or not
// note: leave to the commands to decide whether to print their error
pb.RootCmd.Execute()
done <- true