MCPcopy Index your code
hub / github.com/loft-sh/devpod / devPodUpProxy

Method devPodUpProxy

cmd/up.go:392–466  ·  view source on GitHub ↗
(
	ctx context.Context,
	client client2.ProxyClient,
	log log.Logger,
)

Source from the content-addressed store, hash-verified

390}
391
392func (cmd *UpCmd) devPodUpProxy(
393 ctx context.Context,
394 client client2.ProxyClient,
395 log log.Logger,
396) (*config2.Result, error) {
397 // create pipes
398 stdoutReader, stdoutWriter, err := os.Pipe()
399 if err != nil {
400 return nil, err
401 }
402 stdinReader, stdinWriter, err := os.Pipe()
403 if err != nil {
404 return nil, err
405 }
406 defer stdoutWriter.Close()
407 defer stdinWriter.Close()
408
409 // start machine on stdio
410 cancelCtx, cancel := context.WithCancel(ctx)
411 defer cancel()
412
413 // create up command
414 errChan := make(chan error, 1)
415 go func() {
416 defer log.Debugf("Done executing up command")
417 defer cancel()
418
419 // build devpod up options
420 workspace := client.WorkspaceConfig()
421 baseOptions := cmd.CLIOptions
422 baseOptions.ID = workspace.ID
423 baseOptions.DevContainerPath = workspace.DevContainerPath
424 baseOptions.DevContainerImage = workspace.DevContainerImage
425 baseOptions.IDE = workspace.IDE.Name
426 baseOptions.IDEOptions = nil
427 baseOptions.Source = workspace.Source.String()
428 for optionName, optionValue := range workspace.IDE.Options {
429 baseOptions.IDEOptions = append(
430 baseOptions.IDEOptions,
431 optionName+"="+optionValue.Value,
432 )
433 }
434
435 // run devpod up elsewhere
436 err = client.Up(ctx, client2.UpOptions{
437 CLIOptions: baseOptions,
438 Debug: cmd.Debug,
439
440 Stdin: stdinReader,
441 Stdout: stdoutWriter,
442 })
443 if err != nil {
444 errChan <- fmt.Errorf("executing up proxy command: %w", err)
445 } else {
446 errChan <- nil
447 }
448 }()
449

Callers 1

devPodUpMethod · 0.95

Calls 7

RunUpServerFunction · 0.92
WorkspaceConfigMethod · 0.65
UpMethod · 0.65
CloseMethod · 0.45
DebugfMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected