MCPcopy Index your code
hub / github.com/devspace-sh/devspace / startAttach

Method startAttach

pkg/devspace/devpod/devpod.go:421–459  ·  view source on GitHub ↗
(ctx devspacecontext.Context, devContainer *latest.DevContainer, opts Options, selectedPod *selector.SelectedPodContainer, parent *tomb.Tomb)

Source from the content-addressed store, hash-verified

419}
420
421func (d *devPod) startAttach(ctx devspacecontext.Context, devContainer *latest.DevContainer, opts Options, selectedPod *selector.SelectedPodContainer, parent *tomb.Tomb) error {
422 parent.Go(func() error {
423 id, err := logpkg.AcquireGlobalSilence()
424 if err != nil {
425 return err
426 }
427 defer logpkg.ReleaseGlobalSilence(id)
428
429 // make sure the global log is silent
430 ctx = ctx.WithLogger(ctx.Log().WithPrefixColor("attach ", "yellow+b"))
431 err = attach.StartAttach(
432 ctx,
433 devContainer,
434 newTargetSelector(selectedPod.Pod.Name, selectedPod.Pod.Namespace, selectedPod.Container.Name, parent),
435 DefaultTerminalStdout,
436 DefaultTerminalStderr,
437 DefaultTerminalStdin,
438 parent,
439 )
440 if err != nil {
441 return errors.Wrap(err, "error in attach")
442 }
443
444 // if context is done we just return
445 if ctx.IsDone() {
446 return nil
447 }
448
449 // kill ourselves here
450 if !opts.ContinueOnTerminalExit {
451 kill.StopDevSpace("")
452 } else {
453 parent.Kill(nil)
454 }
455 return nil
456 })
457
458 return nil
459}
460
461func (d *devPod) startTerminal(ctx devspacecontext.Context, devContainer *latest.DevContainer, opts Options, selectedPod *selector.SelectedPodContainer, parent *tomb.Tomb) error {
462 parent.Go(func() error {

Callers 1

startMethod · 0.95

Calls 9

StartAttachFunction · 0.92
StopDevSpaceFunction · 0.92
newTargetSelectorFunction · 0.85
GoMethod · 0.80
KillMethod · 0.80
WithLoggerMethod · 0.65
WithPrefixColorMethod · 0.65
LogMethod · 0.65
IsDoneMethod · 0.65

Tested by

no test coverage detected