// Start the process
967778
func (p *process) Start(ctx context.Context) error {
	_, err := p.shim.task.Start(ctx, &task.StartRequest{
		ID:     p.shim.ID(),
		ExecID: p.id,
	})
	if err != nil {
		return errdefs.FromGRPC(err)
	}
	return nil
}
308394
func (windows *windowsRecord) Start() (string, error) {
	startAction := "Starting " + windows.description + ":"

	m, err := mgr.Connect()
	if err != nil {
		return startAction + failed, getWindowsError(err)
	}
	defer m.Disconnect()
	s, err := m.OpenService(windows.name)
	if err != nil {
		return startAction + failed, getWindowsError(err)
	}
	defer s.Close()
	if err = s.Start(); err != nil {
		return startAction + failed, getWindowsError(err)
	}

	return startAction + " completed.", nil
}
1244767
func (m *Manager) Start() error {
	if !atomic.CompareAndSwapUint32(&m.started, 0, 1) {
		return nil
	}

	return nil
}
658980
func (q *queue) Start() {

	q.mutex.Lock()
	defer q.mutex.Unlock()

	if q.status == queueStopped {
		q.status = queueRunning
		go q.start()
	}
}
1067569
func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.StartResponse, error) {
	container, err := s.getContainer()
	if err != nil {
		return nil, err
	}

	// hold the send lock so that the start events are sent before any exit events in the error case
	s.eventSendMu.Lock()
	p, err := container.Start(ctx, r)
	if err != nil {
		s.eventSendMu.Unlock()
		return nil, errdefs.ToGRPC(err)
	}
	if err := s.ep.Add(container.ID, container.Cgroup()); err != nil {
		logrus.WithError(err).Error("add cg to OOM monitor")
	}
	switch r.ExecID {
	case "":
		s.send(&eventstypes.TaskStart{
			ContainerID: container.ID,
			Pid:         uint32(p.Pid()),
		})
	default:
		s.send(&eventstypes.TaskExecStarted{
			ContainerID: container.ID,
			ExecID:      r.ExecID,
			Pid:         uint32(p.Pid()),
		})
	}
	s.eventSendMu.Unlock()
	return &taskAPI.StartResponse{
		Pid: uint32(p.Pid()),
	}, nil
}
879612
func (l *Lifecycle) Start(ctx context.Context) error {
	for _, hook := range l.hooks {
		if hook.OnStart != nil {
			l.logger.Printf("START\t\t%s()", hook.caller)
			if err := hook.OnStart(ctx); err != nil {
				return err
			}
		}
		l.numStarted++
	}
	return nil
}
757658
func (w *Server) Start() {
	w.wg.Add(1)
	go func(w *Server) {
		w.server.ListenAndServe()
		w.wg.Done()
	}(w)
}
94815
func (l *Conn) Start() {
	go l.reader()
	go l.processMessages()
	l.wgClose.Add(1)
}
1102907
func Start(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "start", Listener: listener}
}
1328991
func (a *Agent) Start(ctx context.Context) error {
	err := errAgentStarted

	a.startOnce.Do(func() {
		close(a.started)
		go a.run(ctx)
		err = nil // clear error above, only once.
	})

	return err
}
1339276
func Start(behaviors Behaviors) {
	http.Handle("/", Handler(behaviors, false))
	log.Fatal(http.ListenAndServe(":8080", nil))
}
196410
func (h *execWorker) start() {
	ticker := h.clock.Tick(h.period)
	h.readyCh <- struct{}{} // For testing.

	for {
		select {
		// If the command takes > period, the command runs continuously.
		case <-ticker:
			logf("Worker running %v to serve %v", h.probeCmd, h.probePath)
			output, err := h.exec.Command("sh", "-c", h.probeCmd).CombinedOutput()
			ts := h.clock.Now()
			func() {
				h.mutex.Lock()
				defer h.mutex.Unlock()
				h.result = execResult{output, err, ts}
			}()
		case <-h.stopCh:
			return
		}
	}
}
136998
func (wm *WorkerManager) Start() {
	go wm.processBatch()
	go wm.commitBatch()
	for {
		startIdle := time.Now()
		// force manager stop to be checked first
		select {
		case <-wm.managerStop:
			return
		default:
			select {
			case batch := <-wm.inputChannel:
				{
					wm.metrics.wMsIdle().Update(time.Since(startIdle))
					if Logger.IsAllowed(TraceLevel) {
						Trace(wm, "WorkerManager got batch")
					}
					wm.metrics.wMsBatchDuration().Time(func() {
						wm.startBatch(batch)
					})
					if Logger.IsAllowed(TraceLevel) {
						Trace(wm, "WorkerManager got batch processed")
					}
				}
			case <-wm.managerStop:
				return
			}
		}
	}
}
863562
func (cmd *Cmd) Start() error {
	if err := cmd.Cmd.Start(); err != nil {
		return err
	}
	go cmd.monitor()
	return nil
}
1127617
func (s *Session) Start() (err error) {
	s.started = true
	var rd *io.PipeReader
	var wr *io.PipeWriter
	var length = len(s.cmds)
	if s.ShowCMD {
		var cmds = make([]string, 0, 4)
		for _, cmd := range s.cmds {
			cmds = append(cmds, strings.Join(cmd.Args, " "))
		}
		s.writePrompt(strings.Join(cmds, " | "))
	}
	for index, cmd := range s.cmds {
		if index == 0 {
			cmd.Stdin = s.Stdin
		} else {
			cmd.Stdin = rd
		}
		if index != length {
			rd, wr = io.Pipe() // create pipe
			cmd.Stdout = wr
			if s.PipeStdErrors {
				cmd.Stderr = s.Stderr
			} else {
				cmd.Stderr = os.Stderr
			}
		}
		if index == length-1 {
			cmd.Stdout = s.Stdout
			cmd.Stderr = s.Stderr
		}
		err = cmd.Start()
		if err != nil {
			return
		}
	}
	return
}
866274
func (self *watcher) Start() {
	go self.startWatching()
	// listens the catched event & start processing.
	for event := range self.event {
		if event == nil {
			continue
		}
		// start processing the event
		var filename = filepath.Base(event.Name)
		for pattern, process := range self.watchList {
			if pattern.MatchString(filename) {
				process(event.Name)
			}
		}
	}
}
726830
func StartProcess(label string, dir string, execPath string, args []string, inFile io.Reader, outFile io.WriteCloser) (*Process, error) {
	cmd := exec.Command(execPath, args...)
	cmd.Dir = dir
	cmd.Stdout = outFile
	cmd.Stderr = outFile
	cmd.Stdin = inFile
	if err := cmd.Start(); err != nil {
		return nil, err
	}
	proc := &Process{
		Label:      label,
		ExecPath:   execPath,
		Args:       args,
		Pid:        cmd.Process.Pid,
		StartTime:  time.Now(),
		Cmd:        cmd,
		ExitState:  nil,
		InputFile:  inFile,
		OutputFile: outFile,
		WaitCh:     make(chan struct{}),
	}
	go func() {
		err := proc.Cmd.Wait()
		if err != nil {
			// fmt.Printf("Process exit: %v\n", err)
			if exitError, ok := err.(*exec.ExitError); ok {
				proc.ExitState = exitError.ProcessState
			}
		}
		proc.ExitState = proc.Cmd.ProcessState
		proc.EndTime = time.Now() // TODO make this goroutine-safe
		err = proc.OutputFile.Close()
		if err != nil {
			fmt.Printf("Error closing output file for %v: %v\n", proc.Label, err)
		}
		close(proc.WaitCh)
	}()
	return proc, nil
}