You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/12/26 14:59:31 UTC

(camel) 03/04: CAMEL-21568: camel-jbang - Debug stepover requires 4.8.3 or better

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

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

commit 56f2a07a15680c5ece0e9f03761e696af0134405
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Dec 26 14:26:01 2024 +0100

    CAMEL-21568: camel-jbang - Debug stepover requires 4.8.3 or better
---
 .../apache/camel/dsl/jbang/core/commands/Debug.java    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
index 853ee393162..268af403bbc 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
@@ -241,6 +241,9 @@ public class Debug extends Run {
 
         cmds.remove("--background=true");
         cmds.remove("--background");
+        cmds.remove("--background-wait=true");
+        cmds.remove("--background-wait=false");
+        cmds.remove("--background-wait");
 
         // remove args from debug that are not supported by run
         removeDebugOnlyOptions(cmds);
@@ -334,6 +337,14 @@ public class Debug extends Run {
         }
     }
 
+    private static boolean isStepOverSupported(String version) {
+        // step-over is Camel 4.8.3 or 4.10 or better (not in 4.9)
+        if ("4.9.0".equals(version)) {
+            return false;
+        }
+        return version == null || VersionHelper.isGE(version, "4.8.3");
+    }
+
     private void printDebugStatus(long pid, StringWriter buffer) {
         JsonObject jo = loadDebug(pid);
         if (jo != null) {
@@ -475,7 +486,12 @@ public class Debug extends Run {
                     }
                 }
 
-                String msg = "    Breakpoint suspended (i = step into (default), o = step over). Press ENTER to continue.";
+                String msg;
+                if (isStepOverSupported(version)) {
+                    msg = "    Breakpoint suspended (i = step into (default), o = step over). Press ENTER to continue.";
+                } else {
+                    msg = "    Breakpoint suspended. Press ENTER to continue.";
+                }
                 if (loggingColor) {
                     AnsiConsole.out().println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(msg).reset());
                 } else {