fixed unhandled panic and wrapped all internal goroutines
This commit is contained in:
+4
-4
@@ -186,21 +186,21 @@ func (pb *PocketBase) Execute() error {
|
||||
done := make(chan bool, 1)
|
||||
|
||||
// listen for interrupt signal to gracefully shutdown the application
|
||||
go func() {
|
||||
routine.FireAndForget(func() {
|
||||
sigch := make(chan os.Signal, 1)
|
||||
signal.Notify(sigch, os.Interrupt, syscall.SIGTERM)
|
||||
<-sigch
|
||||
|
||||
done <- true
|
||||
}()
|
||||
})
|
||||
|
||||
// execute the root command
|
||||
go func() {
|
||||
routine.FireAndForget(func() {
|
||||
// note: leave to the commands to decide whether to print their error
|
||||
pb.RootCmd.Execute()
|
||||
|
||||
done <- true
|
||||
}()
|
||||
})
|
||||
|
||||
<-done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user