@@ -603,12 +603,12 @@ func (cmd *DevCmd) startOutput(configInterface config.Config, dependencies []typ
603603 return 0 , pluginErr
604604 }
605605
606- // if config.Dev.Terminal is defined && config.Images is empty
606+ // if config.Dev.Terminal is defined
607607 // config.Dev.Terminal.ImageSelector is empty &&
608608 // config.Dev.Terminal.LabelSelector is also empty &&
609609 // config.Dev.Terminal.Command is defined then
610610 // run the command locally instead on in container
611- if config .Images == nil && config . Dev .Terminal .ImageSelector == "" &&
611+ if config .Dev .Terminal .ImageSelector == "" &&
612612 config .Dev .Terminal .LabelSelector == nil &&
613613 config .Dev .Terminal .Command != nil &&
614614 len (config .Dev .Terminal .Command ) > 0 {
@@ -624,6 +624,7 @@ func (cmd *DevCmd) startOutput(configInterface config.Config, dependencies []typ
624624 }
625625 // if command succeeds
626626 cmd .log .Infof ("Command '%s' returned: %s" , command , stdout .String ())
627+ _ , _ = cmd .Stdout .Write (stdout .Bytes ()) // pass output to the devspace's stdout
627628 return 0 , nil
628629 } else {
629630 selectorOptions := targetselector .NewDefaultOptions ().ApplyCmdParameter ("" , "" , cmd .Namespace , "" )
@@ -781,31 +782,33 @@ func (cmd *DevCmd) loadConfig(configOptions *loader.ConfigOptions) (config.Confi
781782 // check if terminal is enabled
782783 c := configInterface .Config ()
783784
784- if cmd .Terminal || ( c .Dev .Terminal != nil && ! c . Dev . Terminal . Disabled ) {
785+ if cmd .Terminal && c .Dev .Terminal == nil {
785786 if c .Dev .Terminal == nil || (c .Dev .Terminal .ImageSelector == "" && len (c .Dev .Terminal .LabelSelector ) == 0 ) {
787+ if len (c .Images ) == 0 {
788+ return nil , errors .New ("No image available in devspace config" )
789+ }
790+
786791 imageNames := make ([]string , 0 , len (c .Images ))
787792 for k := range c .Images {
788793 imageNames = append (imageNames , k )
789794 }
790795
791- if len (imageNames ) > 0 {
792- // if only one image exists, use it, otherwise show image picker
793- imageName := ""
794- if len (imageNames ) == 1 {
795- imageName = imageNames [0 ]
796- } else {
797- imageName , err = cmd .log .Question (& survey.QuestionOptions {
798- Question : "Which image do you want to open a terminal to?" ,
799- Options : imageNames ,
800- })
801- if err != nil {
802- return nil , err
803- }
804- }
805- c .Dev .Terminal = & latest.Terminal {
806- ImageSelector : fmt .Sprintf ("${runtime.images.%s.image}:${runtime.images.%s.tag}" , imageName , imageName ),
796+ // if only one image exists, use it, otherwise show image picker
797+ imageName := ""
798+ if len (imageNames ) == 1 {
799+ imageName = imageNames [0 ]
800+ } else {
801+ imageName , err = cmd .log .Question (& survey.QuestionOptions {
802+ Question : "Which image do you want to open a terminal to?" ,
803+ Options : imageNames ,
804+ })
805+ if err != nil {
806+ return nil , err
807807 }
808808 }
809+ c .Dev .Terminal = & latest.Terminal {
810+ ImageSelector : fmt .Sprintf ("${runtime.images.%s.image}:${runtime.images.%s.tag}" , imageName , imageName ),
811+ }
809812
810813 } else {
811814 c .Dev .Terminal .Disabled = false
0 commit comments