Skip to content

Commit

Permalink
update restart service to use new gowrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
zackattack01 committed Apr 30, 2024
1 parent 51b41f8 commit b84ffd4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/launcher/restartservice/restart_service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/kolide/kit/version"
agentsqlite "github.com/kolide/launcher/ee/agent/storage/sqlite"
"github.com/kolide/launcher/ee/gowrapper"
"github.com/kolide/launcher/pkg/launcher"
"github.com/kolide/launcher/pkg/log/multislogger"
"github.com/kolide/launcher/pkg/log/sqlitelogger"
Expand Down Expand Up @@ -119,7 +120,7 @@ func (w *winRestartSvc) Execute(args []string, r <-chan svc.ChangeRequest, chang

runRestartServiceResults := make(chan struct{})

go func() {
gowrapper.Go(ctx, w.systemSlogger.Logger, func() {
err := runLauncherRestartService(ctx, w)
if err != nil {
w.systemSlogger.Log(ctx, slog.LevelInfo,
Expand All @@ -133,9 +134,17 @@ func (w *winRestartSvc) Execute(args []string, r <-chan svc.ChangeRequest, chang
)
}

// Since restart service shut down, we must signal to fully exit so that the service manager can restart the service.
// signal to fully exit so that the service manager can restart the service
runRestartServiceResults <- struct{}{}
}()
}, func(r any) {
w.systemSlogger.Log(ctx, slog.LevelError,
"exiting after runLauncherRestartService panic",
"err", r,
)

// signal to fully exit so that the service manager can restart the service.
runRestartServiceResults <- struct{}{}
})

for {
select {
Expand Down

0 comments on commit b84ffd4

Please sign in to comment.