List running processes for the Service Controller.
(_ struct{}, reply *string)
| 496 | |
| 497 | // List running processes for the Service Controller. |
| 498 | func (s *Service) List(_ struct{}, reply *string) error { |
| 499 | tableString := &strings.Builder{} |
| 500 | table := tablewriter.NewTable(tableString) |
| 501 | table.Header([]string{"Service"}) |
| 502 | |
| 503 | names := []string{} |
| 504 | for t := range s.serviceToken { |
| 505 | if len(s.serviceToken[t]) > 0 { |
| 506 | names = append(names, t) |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | sort.Strings(names) |
| 511 | |
| 512 | for n := range names { |
| 513 | table.Append([]string{names[n]}) |
| 514 | } |
| 515 | |
| 516 | table.Render() |
| 517 | *reply = tableString.String() |
| 518 | return nil |
| 519 | } |
| 520 | |
| 521 | func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) error { |
| 522 | <-ctx.Done() |