MCPcopy
hub / github.com/moby/moby / Execute

Method Execute

daemon/command/service_windows.go:300–337  ·  view source on GitHub ↗
(_ []string, r <-chan svc.ChangeRequest, s chan<- svc.Status)

Source from the content-addressed store, hash-verified

298}
299
300func (h *handler) Execute(_ []string, r <-chan svc.ChangeRequest, s chan<- svc.Status) (bool, uint32) {
301 s <- svc.Status{State: svc.StartPending, Accepts: 0}
302 // Unblock initService()
303 h.fromsvc <- nil
304
305 // Wait for initialization to complete.
306 failed := <-h.tosvc
307 if failed {
308 log.G(context.TODO()).Debug("Aborting service start due to failure during initialization")
309 return true, 1
310 }
311
312 s <- svc.Status{State: svc.Running, Accepts: svc.AcceptStop | svc.AcceptShutdown | svc.AcceptParamChange}
313 log.G(context.TODO()).Debug("Service running")
314Loop:
315 for {
316 select {
317 case failed = <-h.tosvc:
318 break Loop
319 case c := <-r:
320 switch c.Cmd {
321 case svc.ParamChange:
322 h.daemonCLI.reloadConfig()
323 case svc.Interrogate:
324 s <- c.CurrentStatus
325 case svc.Stop, svc.Shutdown:
326 s <- svc.Status{State: svc.StopPending, Accepts: 0}
327 h.daemonCLI.stop()
328 }
329 }
330 }
331
332 removePanicFile()
333 if failed {
334 return true, 1
335 }
336 return false, 0
337}
338
339func initPanicFile(path string) error {
340 var err error

Callers 6

mainFunction · 0.45
mainFunction · 0.45
TestNewParseFunction · 0.45
ParseLogTagFunction · 0.45
ApplyMethod · 0.45
reloadMethod · 0.45

Calls 3

removePanicFileFunction · 0.85
reloadConfigMethod · 0.80
stopMethod · 0.45

Tested by 1

TestNewParseFunction · 0.36