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

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


The following commit(s) were added to refs/heads/main by this push:
     new f7106836942d chore: camel-jbang - quiet printer passes errors to its 
delegate unless printing to the console
f7106836942d is described below

commit f7106836942d1f4b3fb4efd5abc538ad10fdb14c
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 8 15:51:44 2026 +0200

    chore: camel-jbang - quiet printer passes errors to its delegate unless 
printing to the console
    
    Fixes KubernetesRunTest failures since CAMEL-24352 routed QuietPrinter 
errors
    straight to System.err, bypassing the test's StringPrinter.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../main/java/org/apache/camel/dsl/jbang/core/common/Printer.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
index 9d4eb6ecc334..3185ceeed979 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/Printer.java
@@ -103,7 +103,12 @@ public interface Printer {
 
         @Override
         public void printErr(String message) {
-            System.err.printf("ERROR: %s%n", message);
+            if (delegate instanceof SystemOutPrinter) {
+                // keep stdout clean (e.g. MCP stdio JSON-RPC stream) by 
sending errors to stderr
+                System.err.printf("ERROR: %s%n", message);
+            } else {
+                delegate.printErr(message);
+            }
         }
     }
 }

Reply via email to