This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 623736842 Improve error logging with external KAMEL_BIN
623736842 is described below

commit 6237368426758c35489ec2793f1e78035136071e
Author: Jan Bouska <jbou...@redhat.com>
AuthorDate: Wed May 17 14:22:34 2023 +0200

    Improve error logging with external KAMEL_BIN
---
 e2e/support/test_support.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 1823c229a..860eb0b1b 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -379,11 +379,15 @@ func KamelWithContext(ctx context.Context, args 
...string) *cobra.Command {
                        DisableFlagParsing: true,
                        RunE: func(cmd *cobra.Command, args []string) error {
                                externalBin := exec.CommandContext(ctx, 
kamelBin, args...)
-                               var stdout io.Reader
+                               var stdout, stderr io.Reader
                                stdout, err = externalBin.StdoutPipe()
                                if err != nil {
                                        failTest(err)
                                }
+                               stderr, err = externalBin.StderrPipe()
+                               if err != nil {
+                                       failTest(err)
+                               }
                                err := externalBin.Start()
                                if err != nil {
                                        return err
@@ -392,6 +396,10 @@ func KamelWithContext(ctx context.Context, args ...string) 
*cobra.Command {
                                if err != nil {
                                        return err
                                }
+                               _, err = io.Copy(c.ErrOrStderr(), stderr)
+                               if err != nil {
+                                       return err
+                               }
                                err = externalBin.Wait()
                                if err != nil {
                                        return err

Reply via email to