( ctx context.Context, runInCurrentShell bool, requestedServices []string, processComposeOpts devopt.ProcessComposeOpts, )
| 198 | } |
| 199 | |
| 200 | func (d *Devbox) StartProcessManager( |
| 201 | ctx context.Context, |
| 202 | runInCurrentShell bool, |
| 203 | requestedServices []string, |
| 204 | processComposeOpts devopt.ProcessComposeOpts, |
| 205 | ) error { |
| 206 | if !runInCurrentShell { |
| 207 | args := []string{"up", "--run-in-current-shell"} |
| 208 | args = append(args, requestedServices...) |
| 209 | |
| 210 | // TODO: Here we're attempting to reconstruct arguments from the original command, so that we can reinvoke it in devbox shell. |
| 211 | // Instead, we should consider refactoring this so that we can preserve and re-use the original command string, |
| 212 | // because the current approach is fragile and will need to be updated each time we add new flags. |
| 213 | if d.customProcessComposeFile != "" { |
| 214 | args = append(args, "--process-compose-file", d.customProcessComposeFile) |
| 215 | } |
| 216 | if processComposeOpts.Background { |
| 217 | args = append(args, "--background") |
| 218 | } |
| 219 | for _, flag := range processComposeOpts.ExtraFlags { |
| 220 | args = append(args, "--pcflags", flag) |
| 221 | } |
| 222 | if processComposeOpts.ProcessComposePort != 0 { |
| 223 | args = append(args, "--pcport", strconv.Itoa(processComposeOpts.ProcessComposePort)) |
| 224 | } |
| 225 | |
| 226 | return d.runDevboxServicesScript(ctx, args) |
| 227 | } |
| 228 | |
| 229 | svcs, err := d.Services() |
| 230 | if err != nil { |
| 231 | return err |
| 232 | } |
| 233 | |
| 234 | if len(svcs) == 0 { |
| 235 | return usererr.New("No services found in your project") |
| 236 | } |
| 237 | |
| 238 | for _, s := range requestedServices { |
| 239 | if _, ok := svcs[s]; !ok { |
| 240 | return usererr.New("Service %s not found in your project", s) |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | err = initDevboxUtilityProject(ctx, d.stderr) |
| 245 | if err != nil { |
| 246 | return err |
| 247 | } |
| 248 | |
| 249 | processComposeBinPath, err := utilityLookPath("process-compose") |
| 250 | if err != nil { |
| 251 | return err |
| 252 | } |
| 253 | |
| 254 | // Start the process manager |
| 255 | |
| 256 | return services.StartProcessManager( |
| 257 | d.stderr, |
no test coverage detected