(ctx context.Context, projectDir string, w io.Writer)
| 253 | } |
| 254 | |
| 255 | func 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 | |
| 285 | func StopAllProcessManagers(ctx context.Context, w io.Writer) error { |
| 286 | configFile, err := openGlobalConfigFile() |
no test coverage detected