@Override
  public void accept(ProcessBuilder processBuilder) {
    String subdirectory = String.format("test-worker-%06d", WORKER_ID.getAndIncrement());
    Path originalWorkingDirectory = processBuilder.directory().toPath();
    Path newWorkingDirectory = originalWorkingDirectory.resolve(subdirectory);

    try {
      Files.createDirectories(newWorkingDirectory);
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
    processBuilder.directory(newWorkingDirectory.toFile());

    Path originalPropertiesFile = originalWorkingDirectory.resolve(PROPERTIES_FILE_NAME);
    if (Files.exists(originalPropertiesFile)) {
      Path newPropertiesFile = newWorkingDirectory.resolve(PROPERTIES_FILE_NAME);
      copy(originalPropertiesFile, newPropertiesFile);
    }

    // If the command specifies a gradle worker classpath file that exists, copy the file to the
    // unique working directory and update the command line argument to refer to the new location.
    List<String> command = processBuilder.command();
    findGradleWorkerClasspathArg(command)
        .ifPresent(i -> updateGradleWorkerClasspathFile(command, i, newWorkingDirectory));

    upgradeRelativePaths(command);

    log.debug("WorkingDirectoryIsolator updated command. New Working directory: {}, Command: {}", newWorkingDirectory, command);
  }
Each test task gives all of its test workers the same working directory. Because
Geode tests cannot tolerate this when run in parallel, we give each test worker its
own unique working directory.
build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java