[optimize] yao start command

This commit is contained in:
Max 2023-01-14 18:02:12 +08:00
parent e709c8e527
commit d3349edf09
2 changed files with 16 additions and 3 deletions

View file

@ -118,7 +118,13 @@ var startCmd = &cobra.Command{
if mode == "development" {
// Start Studio Server
go studio.Start(config.Conf)
go func() {
err := studio.Start(config.Conf)
if err != nil {
fmt.Println(color.RedString(L("Fatal: %s"), err.Error()))
os.Exit(1)
}
}()
defer studio.Stop()
printApis(false)
@ -147,7 +153,14 @@ var startCmd = &cobra.Command{
}
// Start server
go service.Start()
go func() {
err := service.Start()
if err != nil {
fmt.Println(color.RedString(L("Fatal: %s"), err.Error()))
os.Exit(1)
}
}()
fmt.Println(color.GreenString(L("✨LISTENING✨")))
for {

View file

@ -66,7 +66,7 @@ func SessionFile() error {
burndb, err := session.NewBuntDB(file)
if err != nil {
return err
return fmt.Errorf("Session Store File %s Error: %s. Try to remove the file then restart", file, err.Error())
}
session.Register("file", burndb)