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

Function StopProcessManager

internal/services/manager.go:255–283  ·  view source on GitHub ↗
(ctx context.Context, projectDir string, w io.Writer)

Source from the content-addressed store, hash-verified

253}
254
255func StopProcessManager(ctx context.Context, projectDir string, w io.Writer) error {
256 configFile, err := openGlobalConfigFile()
257 if err != nil {
258 return err
259 }
260
261 defer configFile.Close()
262
263 config := readGlobalProcessComposeJSON(configFile)
264
265 project, ok := config.Instances[projectDir]
266 if !ok {
267 return fmt.Errorf("process-compose is not running or it's config is missing. To start it, run `devbox services up`")
268 }
269
270 defer func() {
271 delete(config.Instances, projectDir)
272 err = writeGlobalProcessComposeJSON(config, configFile)
273 }()
274
275 pid, _ := os.FindProcess(project.Pid)
276 err = pid.Signal(os.Interrupt)
277 if err != nil {
278 return fmt.Errorf("process-compose is not running. To start it, run `devbox services up`")
279 }
280
281 fmt.Fprintf(w, "Process-compose stopped successfully.\n")
282 return nil
283}
284
285func StopAllProcessManagers(ctx context.Context, w io.Writer) error {
286 configFile, err := openGlobalConfigFile()

Callers 1

StopServicesMethod · 0.92

Calls 3

openGlobalConfigFileFunction · 0.85

Tested by

no test coverage detected