davsclaus commented on code in PR #27932:
URL: https://github.com/apache/camel/pull/27932#discussion_r4290960380
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CommandLineHelper.java:
##########
@@ -201,6 +203,40 @@ private static Path getUserPropertyFile(boolean local) {
*
* @return the user home directory.
*/
+ /**
+ * The arguments of a command line typed as one text, such as
<tt>--jvm-args</tt>: split at whitespace outside
Review Comment:
Good catch, fixed in the next commit: `splitArguments` now comes after
`getHomeDir()`, so its javadoc is back on it.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogBaseCommand.java:
##########
@@ -224,14 +224,19 @@ int sortRow(Row o1, Row o2) {
return o1.name.compareToIgnoreCase(o2.name) * negate;
case "level":
case "support-level":
- return o1.level.compareToIgnoreCase(o2.level) * negate;
+ return compareIgnoreCase(o1.level, o2.level) * negate;
case "description":
- return o1.description.compareToIgnoreCase(o2.description) *
negate;
+ return compareIgnoreCase(o1.description, o2.description) *
negate;
default:
return 0;
}
}
+ // a missing value sorts first
+ private static int compareIgnoreCase(String s1, String s2) {
Review Comment:
Fixed in the next commit: `CatalogKamelet` (which is not a
`CatalogBaseCommand`) calls the package-private
`CatalogBaseCommand.compareIgnoreCase`, and its own copy is gone.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java:
##########
@@ -801,28 +803,52 @@ private Integer deployProject(String workingDir, boolean
reload) throws Exceptio
pb.command(args.toArray(String[]::new));
- if (quiet || !verbose) {
- pb.redirectErrorStream(true);
- pb.redirectOutput(ProcessBuilder.Redirect.DISCARD);
- } else {
- pb.inheritIO(); // run in foreground (with IO so logs are visible)
- }
-
+ Path log = mavenOutput(pb);
Process p = pb.start();
// wait for that process to exit as we run in foreground
int exit = p.waitFor();
if (exit != 0) {
- String msg = "Deployment to %s failed!";
- if (!verbose) {
- msg += " (use --verbose for more details)";
- }
- printer().printErr(msg.formatted(clusterType));
+ printer().printErr("Deployment to %s
failed!".formatted(clusterType));
+ printMavenOutput(log);
return exit;
}
return 0;
}
+ /**
+ * Shows the output of Maven with --verbose, and keeps it in a log file
otherwise, for when it fails.
+ *
+ * @return the log file, or <tt>null</tt> with --verbose
+ */
+ private Path mavenOutput(ProcessBuilder pb) throws IOException {
+ if (!quiet && verbose) {
+ pb.inheritIO(); // run in foreground (with IO so logs are visible)
+ return null;
+ }
+ Path log = Files.createTempFile("camel-kubernetes-", ".log");
+ log.toFile().deleteOnExit();
Review Comment:
Fixed in the next commit: the build and the deployment remove the Maven log
in a `finally` once Maven has ended (after printing its end on a failure). With
`--dev` a log was created on every redeploy and only removed when the JVM
exited. `deleteOnExit` stays as the fallback when the file cannot be removed.
_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]