File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -145,10 +145,9 @@ func restartAgent(ctx context.Context) error {
145145
146146 restartViaServiceFn := func (ctx context.Context ) error {
147147 topPath := paths .Top ()
148- install .StopService (topPath )
149- err := install .StartService (topPath )
148+ err := install .RestartService (topPath )
150149 if err != nil {
151- return err
150+ return fmt . Errorf ( "failed to restart agent via service: %w" , err )
152151 }
153152
154153 return nil
Original file line number Diff line number Diff line change @@ -172,6 +172,16 @@ func StopService(topPath string) error {
172172 return nil
173173}
174174
175+ // RestartService stops and starts the installed service.
176+ func RestartService (topPath string ) error {
177+ err := StopService (topPath )
178+ if err != nil {
179+ return err
180+ }
181+
182+ return StartService (topPath )
183+ }
184+
175185// FixPermissions fixes the permissions on the installed system.
176186func FixPermissions (topPath string ) error {
177187 return fixPermissions (topPath )
You can’t perform that action at this time.
0 commit comments