| 305 | } |
| 306 | |
| 307 | func (h *handler) Execute(_ []string, r <-chan svc.ChangeRequest, s chan<- svc.Status) (bool, uint32) { |
| 308 | s <- svc.Status{State: svc.StartPending, Accepts: 0} |
| 309 | // Unblock launchService() |
| 310 | h.fromsvc <- nil |
| 311 | |
| 312 | s <- svc.Status{State: svc.Running, Accepts: svc.AcceptStop | svc.AcceptShutdown | svc.Accepted(windows.SERVICE_ACCEPT_PARAMCHANGE)} |
| 313 | |
| 314 | Loop: |
| 315 | for c := range r { |
| 316 | switch c.Cmd { |
| 317 | case svc.Interrogate: |
| 318 | s <- c.CurrentStatus |
| 319 | case svc.Stop, svc.Shutdown: |
| 320 | s <- svc.Status{State: svc.StopPending, Accepts: 0} |
| 321 | h.s.Stop() |
| 322 | break Loop |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | removePanicFile() |
| 327 | close(h.done) |
| 328 | return false, 0 |
| 329 | } |
| 330 | |
| 331 | func initPanicFile(path string) error { |
| 332 | var err error |