// LoadStatus returns service status
352093
func (s Service) LoadStatus() (*ServiceStatus, error) {
	out, err := exec.Command("/bin/launchctl", "list").Output()
	if err != nil {
		return nil, err
	}

	var pid, lastExitStatus string
	var found bool
	scanner := bufio.NewScanner(bytes.NewBuffer(out))
	for scanner.Scan() {
		line := scanner.Text()
		fields := strings.Fields(line)
		if len(fields) == 3 && fields[2] == s.label {
			found = true
			if fields[0] != "-" {
				pid = fields[0]
			}
			if fields[1] != "-" {
				lastExitStatus = fields[1]
			}
		}
	}

	if found {
		// If pid is set and > 0, then clear lastExitStatus which is the
		// exit status of the previous run and doesn't mean anything for
		// the current state. Clearing it to avoid confusion.
		pidInt, _ := strconv.ParseInt(pid, 0, 64)
		if pid != "" && pidInt > 0 {
			lastExitStatus = ""
		}
		return &ServiceStatus{label: s.label, pid: pid, lastExitStatus: lastExitStatus}, nil
	}

	return nil, nil
}
158161
func (s *ContainerInstance) SetStatus(v string) *ContainerInstance {
	s.Status = &v
	return s
}
936861
func (c *CommitsComparison) GetStatus() string {
	if c == nil || c.Status == nil {
		return ""
	}
	return *c.Status
}
592297
func (s *StreamProcessor) SetStatus(v string) *StreamProcessor {
	s.Status = &v
	return s
}
915602
func (c *CommitFile) GetStatus() string {
	if c == nil || c.Status == nil {
		return ""
	}
	return *c.Status
}
349603
func (s *ResourceShare) SetStatus(v string) *ResourceShare {
	s.Status = &v
	return s
}
399845
func (s *ServiceSpecificCredentialMetadata) SetStatus(v string) *ServiceSpecificCredentialMetadata {
	s.Status = &v
	return s
}
151456
func (s *Resource) SetStatus(v string) *Resource {
	s.Status = &v
	return s
}
611951
func (c *FakeDeployments) UpdateStatus(deployment *v1beta2.Deployment) (*v1beta2.Deployment, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &v1beta2.Deployment{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta2.Deployment), err
}
765000
func (s *ComplianceItemEntry) SetStatus(v string) *ComplianceItemEntry {
	s.Status = &v
	return s
}
544860
func (s *ApplicationVersionDescription) SetStatus(v string) *ApplicationVersionDescription {
	s.Status = &v
	return s
}
474990
func (s *ImportTask) SetStatus(v string) *ImportTask {
	s.Status = &v
	return s
}
541238
func (c *FakeServices) UpdateStatus(service *corev1.Service) (*corev1.Service, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &corev1.Service{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.Service), err
}
436327
func (s *InstanceGroup) SetStatus(v *InstanceGroupStatus) *InstanceGroup {
	s.Status = v
	return s
}
855357
func serveStatus(resp http.ResponseWriter, req *http.Request, sb *safebrowsing.SafeBrowser) {
	stats, sbErr := sb.Status()
	errStr := ""
	if sbErr != nil {
		errStr = sbErr.Error()
	}
	buf, err := json.Marshal(struct {
		Stats safebrowsing.Stats
		Error string
	}{stats, errStr})
	if err != nil {
		http.Error(resp, err.Error(), http.StatusInternalServerError)
		return
	}
	resp.Header().Set("Content-Type", mimeJSON)
	resp.Write(buf)
}
590020
func (s *Service) RegisterStatus(key string, stat Statuser) error {
	s.statusMu.Lock()
	defer s.statusMu.Unlock()

	if _, ok := s.statuses[key]; ok {
		return fmt.Errorf("status already registered with key %s", key)
	}
	s.statuses[key] = stat

	return nil
}
1289886
func (s *DeploymentJob) SetStatus(v string) *DeploymentJob {
	s.Status = &v
	return s
}