This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 21a55f829f35e77114ead8e14eaad1e9775814f7 Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Tue Mar 23 12:32:57 2021 +0100 fix(e2e): Handle external Kamel CLI binary errors --- e2e/support/test_support.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index b296bec..f9a6f5c 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -176,19 +176,26 @@ func KamelWithContext(ctx context.Context, args ...string) *cobra.Command { fmt.Printf("Using external kamel binary on path %s\n", kamelBin) c = &cobra.Command{ DisableFlagParsing: true, - Run: func(cmd *cobra.Command, args []string) { - - externalBin := exec.Command(kamelBin, args...) + RunE: func(cmd *cobra.Command, args []string) error { + externalBin := exec.CommandContext(ctx, kamelBin, args...) var stdout io.Reader stdout, err = externalBin.StdoutPipe() if err != nil { panic(err) } - - externalBin.Start() - io.Copy(c.OutOrStdout(), stdout) - externalBin.Wait() - + err := externalBin.Start() + if err != nil { + return err + } + _, err = io.Copy(c.OutOrStdout(), stdout) + if err != nil { + return err + } + err = externalBin.Wait() + if err != nil { + return err + } + return nil }, } } else {