MCPcopy Index your code
hub / github.com/jetify-com/devbox / StopServices

Method StopServices

internal/devbox/services.go:59–96  ·  view source on GitHub ↗
(ctx context.Context, runInCurrentShell, allProjects bool, serviceNames ...string)

Source from the content-addressed store, hash-verified

57}
58
59func (d *Devbox) StopServices(ctx context.Context, runInCurrentShell, allProjects bool, serviceNames ...string) error {
60 if !runInCurrentShell {
61 args := []string{"stop", "--run-in-current-shell"}
62 args = append(args, serviceNames...)
63 if allProjects {
64 args = append(args, "--all-projects")
65 }
66 return d.runDevboxServicesScript(ctx, args)
67 }
68
69 if allProjects {
70 return services.StopAllProcessManagers(ctx, d.stderr)
71 }
72
73 if !services.ProcessManagerIsRunning(d.projectDir) {
74 return usererr.New("Process manager is not running. Run `devbox services up` to start it.")
75 }
76
77 if len(serviceNames) == 0 {
78 return services.StopProcessManager(ctx, d.projectDir, d.stderr)
79 }
80
81 svcSet, err := d.Services()
82 if err != nil {
83 return err
84 }
85
86 for _, s := range serviceNames {
87 if _, ok := svcSet[s]; !ok {
88 return usererr.New("Service %s not found in your project", s)
89 }
90 err := services.StopServices(ctx, s, d.projectDir, d.stderr)
91 if err != nil {
92 fmt.Fprintf(d.stderr, "Error stopping service %s: %s", s, err)
93 }
94 }
95 return nil
96}
97
98func (d *Devbox) ListServices(ctx context.Context, runInCurrentShell bool) error {
99 if !runInCurrentShell {

Callers 1

stopServicesFunction · 0.80

Calls 7

ServicesMethod · 0.95
StopAllProcessManagersFunction · 0.92
ProcessManagerIsRunningFunction · 0.92
NewFunction · 0.92
StopProcessManagerFunction · 0.92
StopServicesFunction · 0.92

Tested by

no test coverage detected