diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-07 21:19:38 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 00:23:01 +1100 |
commit | 79e59d5460d838203bc79ac86c0ba529305ba2a9 (patch) | |
tree | 7a7d6c48440f02945599606494ac64424d274f58 /pkg/updates | |
parent | ba4c3e5bc475a7819fd954985105073ba239bf9e (diff) |
add some safe goroutines
WIP
Diffstat (limited to 'pkg/updates')
-rw-r--r-- | pkg/updates/updates.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go index 163773e58..ba7df37ac 100644 --- a/pkg/updates/updates.go +++ b/pkg/updates/updates.go @@ -145,12 +145,12 @@ func (u *Updater) CheckForNewUpdate(onFinish func(string, error) error, userRequ return } - go func() { + go utils.Safe(func() { newVersion, err := u.checkForNewUpdate() if err = onFinish(newVersion, err); err != nil { u.Log.Error(err) } - }() + }) } func (u *Updater) skipUpdateCheck() bool { @@ -235,12 +235,12 @@ func (u *Updater) getBinaryUrl(newVersion string) (string, error) { // Update downloads the latest binary and replaces the current binary with it func (u *Updater) Update(newVersion string, onFinish func(error) error) { - go func() { + go utils.Safe(func() { err := u.update(newVersion) if err = onFinish(err); err != nil { u.Log.Error(err) } - }() + }) } func (u *Updater) update(newVersion string) error { |