diff --git a/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java b/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java index 89b583893..dd2a3ab76 100644 --- a/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java +++ b/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java @@ -67,12 +67,14 @@ class CRunStrategy implements TestRunStrategy { List runtimeOutput = new ArrayList<>(); List stdout = new ArrayList<>(); outputFile.setExecutable(true); - List runCommand = new ArrayList<>(); - runCommand.add(outputFile.getPath()); - if (run.getArgument() != null) { - runCommand.add(run.getArgument()); + synchronized (this) { + List runCommand = new ArrayList<>(); + runCommand.add(outputFile.getPath()); + if (run.getArgument() != null) { + runCommand.add(run.getArgument()); + } + runProcess(new ProcessBuilder(runCommand.toArray(new String[0])).start(), runtimeOutput, stdout); } - runProcess(new ProcessBuilder(runCommand.toArray(new String[0])).start(), runtimeOutput, stdout); if (!stdout.isEmpty() && stdout.get(stdout.size() - 1).equals("SUCCESS")) { writeLines(runtimeOutput); run.getCallback().complete();