Skip to content

Commit

Permalink
remove pid from args
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoles committed Feb 5, 2025
1 parent 77706d8 commit 9f6a840
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions pitest-entry/src/main/java/org/pitest/process/Java9Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public class Java9Process implements WrappingProcess {
private final Class<?> minionClass;
private JavaProcess process;

private final long pid = ProcessHandle.current().pid();

private static int counter = 0;

public Java9Process(int port, ProcessArgs args, Class<?> minionClass) {
this.port = port;
this.processArgs = args;
Expand Down Expand Up @@ -124,12 +120,10 @@ private List<String> createLaunchArgs(JavaAgent agentJarLocator, List<String> ar
}

private Path createArgsFile(List<String> cmd) throws IOException {
// To avoid conflicts with running analysis, we use the PID as part of the file name
// To prevent conflicts between multiple threads counter is used
// All files should be deleted on process exit, although some garbage may be left
// if the process is killed. Files are however created in the system temp directory
// so should be cleaned up on reboot
String name = "pitest-args-" + pid + "-" + nextCounter();
String name = "pitest-args-";
Path args = Files.createTempFile(name, ".args");
args.toFile().deleteOnExit();
Files.write(args, cmd);
Expand Down Expand Up @@ -157,8 +151,4 @@ private static Predicate<String> isJavaAgentParam() {
return a -> a.toLowerCase().startsWith("-javaagent");
}

private static synchronized int nextCounter() {
return counter++;
}

}

0 comments on commit 9f6a840

Please sign in to comment.