Skip to content

Commit d81fe70

Browse files
committed
Use service manager's restart
1 parent f5560d0 commit d81fe70

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/pkg/agent/install/install.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,18 @@ func StopService(topPath string) error {
174174

175175
// RestartService stops and starts the installed service.
176176
func RestartService(topPath string) error {
177-
err := StopService(topPath)
177+
svc, err := newService(topPath)
178178
if err != nil {
179179
return err
180180
}
181-
182-
return StartService(topPath)
181+
err = svc.Restart()
182+
if err != nil {
183+
return errors.New(
184+
err,
185+
fmt.Sprintf("failed to restart service (%s)", paths.ServiceName),
186+
errors.M("service", paths.ServiceName))
187+
}
188+
return nil
183189
}
184190

185191
// FixPermissions fixes the permissions on the installed system.

0 commit comments

Comments
 (0)