davsclaus commented on code in PR #27399:
URL: https://github.com/apache/camel/pull/27399#discussion_r4194086454


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java:
##########
@@ -218,6 +238,61 @@ private static RuntimeHelper.ProcessInfo findByPid(long 
pid) {
         return null;
     }
 
+    /**
+     * The console output of a run that failed to start, as camel_get_log 
shows a log (CAMEL-25364): each record keeps
+     * its message, an error its root cause and the first line of the user's 
code, and the stack frames are left out.
+     * The end of the raw output is mostly frames of the runtime, and the line 
that says what went wrong is above them.
+     */
+    static String failureOutput(Path output) {
+        List<String> lines;
+        try {
+            lines = Files.readAllLines(output, StandardCharsets.UTF_8);

Review Comment:
   Applied in 57b420404b, for both `failureOutput` and `readTail` (a shared 
`readText` that decodes the bytes leniently). 
`failureOutputThatIsNotUtf8IsKept` writes `J\\u00f6rg` in ISO-8859-1.
   
   _Claude Code on behalf of davsclaus_



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java:
##########
@@ -72,6 +76,22 @@ public static JsonObject run(Path directory, List<String> 
files, String name, bo
             return result;
         }
         result.put("directory", directory.toString());
+        if (sourceDir) {
+            // the whole directory is the app: one already running from it is 
that app, and a second copy only fights
+            // it for ports and files and makes its name ambiguous to the 
other tools
+            RuntimeHelper.ProcessInfo running = runningFrom(directory);
+            if (running != null) {
+                String runningName = running.contextName() != null && 
!running.contextName().isBlank()
+                        ? running.contextName() : running.name();
+                result.put("status", "running");
+                result.put("pid", running.pid());
+                result.put("name", runningName);

Review Comment:
   Applied in 57b420404b; the guard test asserts `log` on the running result.
   
   _Claude Code on behalf of davsclaus_



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java:
##########
@@ -218,6 +238,61 @@ private static RuntimeHelper.ProcessInfo findByPid(long 
pid) {
         return null;
     }
 
+    /**
+     * The console output of a run that failed to start, as camel_get_log 
shows a log (CAMEL-25364): each record keeps
+     * its message, an error its root cause and the first line of the user's 
code, and the stack frames are left out.
+     * The end of the raw output is mostly frames of the runtime, and the line 
that says what went wrong is above them.
+     */
+    static String failureOutput(Path output) {
+        List<String> lines;
+        try {
+            lines = Files.readAllLines(output, StandardCharsets.UTF_8);

Review Comment:
   Applied in 57b420404b, for both `failureOutput` and `readTail` (a shared 
`readText` that decodes the bytes leniently). 
`failureOutputThatIsNotUtf8IsKept` writes `C:\Users\Jörg\...` in ISO-8859-1.
   
   _Claude Code on behalf of davsclaus_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to