async update check

This commit is contained in:
olebeck 2023-03-30 13:54:11 +02:00
parent 191f1ecd9a
commit b7ad339a64

View File

@ -78,14 +78,16 @@ func main() {
logrus.Infof(locale.Loc("bedrocktool_version", locale.Strmap{"Version": utils.Version})) logrus.Infof(locale.Loc("bedrocktool_version", locale.Strmap{"Version": utils.Version}))
} }
newVersion, err := utils.Updater.UpdateAvailable() go func() {
if err != nil { newVersion, err := utils.Updater.UpdateAvailable()
logrus.Error(err) if err != nil {
} logrus.Error(err)
}
if newVersion != "" && utils.Version != "" { if newVersion != "" && utils.Version != "" {
logrus.Infof(locale.Loc("update_available", locale.Strmap{"Version": newVersion})) logrus.Infof(locale.Loc("update_available", locale.Strmap{"Version": newVersion}))
} }
}()
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -125,7 +127,7 @@ func main() {
logrus.Error("Failed to init UI!") logrus.Error("Failed to init UI!")
return return
} }
err = ui.Start(ctx, cancel) err := ui.Start(ctx, cancel)
cancel() cancel()
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)