From c7204a56eee39355e4e03185425d59763acbe77b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 10 Nov 2019 21:13:43 +0100 Subject: [PATCH] Fix build under Windows --- .../src/test/java/net/sourceforge/pmd/it/PMDExecutor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/it/PMDExecutor.java b/pmd-dist/src/test/java/net/sourceforge/pmd/it/PMDExecutor.java index 05bd0a9755..2ea7115844 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/it/PMDExecutor.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/it/PMDExecutor.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -36,7 +37,10 @@ public class PMDExecutor { private static ExecutionResult runPMDUnix(Path tempDir, Path reportFile, String ... arguments) throws Exception { String cmd = tempDir.resolve(PMD_BIN_PREFIX + PMDVersion.VERSION + "/bin/run.sh").toAbsolutePath().toString(); - return runPMD(cmd, Arrays.asList(arguments), reportFile); + List args = new ArrayList<>(); + args.add("pmd"); + args.addAll(Arrays.asList(arguments)); + return runPMD(cmd, args, reportFile); } private static ExecutionResult runPMDWindows(Path tempDir, Path reportFile, String ... arguments) throws Exception { @@ -45,7 +49,7 @@ public class PMDExecutor { } private static ExecutionResult runPMD(String cmd, List arguments, Path reportFile) throws Exception { - ProcessBuilder pb = new ProcessBuilder(cmd, "pmd"); + ProcessBuilder pb = new ProcessBuilder(cmd); pb.command().addAll(arguments); pb.redirectErrorStream(false); final Process process = pb.start();