Skip to content

Commit

Permalink
Use gowrapper for goroutine execution and add error handling for runG…
Browse files Browse the repository at this point in the history
…roup panics
  • Loading branch information
cesarfda committed Dec 11, 2024
1 parent 10cee88 commit 1764b2f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/launcher/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/kolide/launcher/ee/desktop/user/notify"
userserver "github.com/kolide/launcher/ee/desktop/user/server"
"github.com/kolide/launcher/ee/desktop/user/universallink"
"github.com/kolide/launcher/ee/gowrapper"
"github.com/kolide/launcher/pkg/authedclient"
"github.com/kolide/launcher/pkg/log/multislogger"
"github.com/kolide/launcher/pkg/rungroup"
Expand Down Expand Up @@ -185,15 +186,20 @@ func runDesktop(_ *multislogger.MultiSlogger, args []string) error {
}, func(err error) {})

// run run group
go func() {
gowrapper.Go(context.TODO(), slogger, func() {
// have to run this in a goroutine because menu needs the main thread
if err := runGroup.Run(); err != nil {
slogger.Log(context.TODO(), slog.LevelError,
"running run group",
"err", err,
)
}
}()
}, func(r any) {
slogger.Log(context.TODO(), slog.LevelError,
"exiting after runGroup panic",
"err", r,
)
})

// if desktop is not enabled at start up, wait for send on show desktop channel
if !*flDesktopEnabled {
Expand Down

0 comments on commit 1764b2f

Please sign in to comment.