Skip to content

Commit

Permalink
log input and output files for CmdLineEngine
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Niederhauser <ghuder5@gmx.ch>
  • Loading branch information
nidi3 committed Jun 10, 2020
1 parent b1f81de commit fde9e62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import static guru.nidi.graphviz.service.CommandRunner.isExecutableFile;
import static guru.nidi.graphviz.service.CommandRunner.isExecutableFound;
import static guru.nidi.graphviz.service.SystemUtils.pathOf;
import static guru.nidi.graphviz.service.SystemUtils.uriPathOf;
import static java.util.Locale.ENGLISH;

/**
Expand All @@ -42,7 +43,7 @@
* @author daank
*/
public class GraphvizCmdLineEngine extends AbstractGraphvizEngine {
private static final Logger LOG = LoggerFactory.getLogger(AbstractGraphvizEngine.class);
private static final Logger LOG = LoggerFactory.getLogger(GraphvizCmdLineEngine.class);
static final boolean AVAILABLE = isOnClasspath("org/apache/commons/exec/CommandLine.class");

@Nullable
Expand Down Expand Up @@ -126,8 +127,10 @@ private EngineResult doExecute(Path path, File dotFile, Options options, Rasteri
+ " -K" + options.engine.toString().toLowerCase(ENGLISH)
+ " -T" + completeFormat(options.format, rasterizer)
+ " " + dotFile.getAbsolutePath() + " -ooutfile." + simpleFormat;
LOG.info("input file://{}", uriPathOf(dotFile));
cmdRunner.exec(command, path.toFile(), timeout);
final Path outFile = path.resolve("outfile." + simpleFormat);
LOG.info("output file://{}", uriPathOf(outFile.toFile()));
if (rasterizer instanceof BuiltInRasterizer) {
return EngineResult.fromFile(outFile.toFile());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static Path pathOf(String path) {

public static String uriPathOf(String path) {
if (IS_OS_WINDOWS) {
return (path.substring(1, 3).equals(":\\") ? "/" : "") + path.replace('\\', '/');
return (path.startsWith(":\\", 1) ? "/" : "") + path.replace('\\', '/');
}
return path;
}
Expand Down

0 comments on commit fde9e62

Please sign in to comment.