(ctx context.Context, w io.Writer, projectDir string, processComposeConfig ProcessComposeOpts)
| 311 | } |
| 312 | |
| 313 | func AttachToProcessManager(ctx context.Context, w io.Writer, projectDir string, processComposeConfig ProcessComposeOpts) error { |
| 314 | configFile, err := openGlobalConfigFile() |
| 315 | if err != nil { |
| 316 | return err |
| 317 | } |
| 318 | |
| 319 | config := readGlobalProcessComposeJSON(configFile) |
| 320 | configFile.Close() // release the lock as this command is long running |
| 321 | |
| 322 | project, ok := config.Instances[projectDir] |
| 323 | if !ok { |
| 324 | return fmt.Errorf("process-compose is not running for this project. To start it, run `devbox services up`") |
| 325 | } |
| 326 | |
| 327 | flags := []string{"attach", "-p", strconv.Itoa(project.Port)} |
| 328 | cmd := exec.Command(processComposeConfig.BinPath, flags...) |
| 329 | |
| 330 | cmd.Stdout = os.Stdout |
| 331 | cmd.Stderr = os.Stderr |
| 332 | cmd.Stdin = os.Stdin |
| 333 | |
| 334 | return cmd.Run() |
| 335 | } |
| 336 | |
| 337 | func ProcessManagerIsRunning(projectDir string) bool { |
| 338 | configFile, err := openGlobalConfigFile() |
no test coverage detected