Skip to content

Commit

Permalink
Use service manager's restart
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Aug 22, 2023
1 parent f5560d0 commit d81fe70
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/pkg/agent/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,18 @@ func StopService(topPath string) error {

// RestartService stops and starts the installed service.
func RestartService(topPath string) error {
err := StopService(topPath)
svc, err := newService(topPath)
if err != nil {
return err
}

return StartService(topPath)
err = svc.Restart()
if err != nil {
return errors.New(
err,
fmt.Sprintf("failed to restart service (%s)", paths.ServiceName),
errors.M("service", paths.ServiceName))
}
return nil
}

// FixPermissions fixes the permissions on the installed system.
Expand Down

0 comments on commit d81fe70

Please sign in to comment.