until https://github.com/golang/go/issues/23239 is release, we will need to configure through ChangeServiceConfig2
(handle windows.Handle)
| 301 | // until https://github.com/golang/go/issues/23239 is release, we will need to |
| 302 | // configure through ChangeServiceConfig2 |
| 303 | func configRecoveryOption(handle windows.Handle) error { |
| 304 | actions := []recoveryAction{ |
| 305 | {recoveryType: uint32(scActionRestart), delay: uint32(recoverActionDelay / time.Millisecond)}, |
| 306 | } |
| 307 | serviceRecoveryActions := serviceFailureActions{ |
| 308 | resetPeriod: uint32(failureCountResetPeriod / time.Second), |
| 309 | actionCount: uint32(len(actions)), |
| 310 | actions: uintptr(unsafe.Pointer(&actions[0])), |
| 311 | } |
| 312 | if err := windows.ChangeServiceConfig2(handle, windows.SERVICE_CONFIG_FAILURE_ACTIONS, (*byte)(unsafe.Pointer(&serviceRecoveryActions))); err != nil { |
| 313 | return err |
| 314 | } |
| 315 | serviceFailureActionsFlag := serviceFailureActionsFlag{enableActionsForStopsWithErr: 1} |
| 316 | return windows.ChangeServiceConfig2(handle, serviceConfigFailureActionsFlag, (*byte)(unsafe.Pointer(&serviceFailureActionsFlag))) |
| 317 | } |
no outgoing calls
no test coverage detected