Skip to content

Commit

Permalink
chore: Fix Camel JBang output file directory auto creation
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Jan 20, 2025
1 parent 5c571c8 commit d0c0ad5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private static ProcessAndOutput executeAsync(List<String> command, Path workingD
*/
private static ProcessAndOutput executeAsync(List<String> command, Path workingDir, File outputFile, Map<String, String> envVars) {
try {
if (!outputFile.getParentFile().mkdirs()) {
if (!outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs()) {
throw new CitrusRuntimeException("Unable to create process output directory: " + outputFile.getParent());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.jbang.JBangSupport;
import org.citrusframework.jbang.ProcessAndOutput;
import org.citrusframework.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -49,6 +50,8 @@ public class CamelJBang {

private boolean dumpIntegrationOutput = CamelJBangSettings.isDumpIntegrationOutput();

private String version;

/**
* Prevent direct instantiation.
*/
Expand All @@ -65,7 +68,10 @@ private CamelJBang() {
camelApp.trust(url);
}

logger.info("Camel JBang version: " + version());
String version = version();
if (logger.isDebugEnabled()) {
logger.debug("Camel JBang version: " + version);
}
}

/**
Expand Down Expand Up @@ -145,8 +151,12 @@ public String ps() {
* Get Camel JBang version.
*/
public String version() {
ProcessAndOutput p = camelApp.run("--version");
return p.getOutput();
if (!StringUtils.hasText(version)) {
ProcessAndOutput p = camelApp.run("--version");
version = p.getOutput();
}

return version;
}

/**
Expand Down

0 comments on commit d0c0ad5

Please sign in to comment.