demery-pivotal commented on a change in pull request #7151:
URL: https://github.com/apache/geode/pull/7151#discussion_r759658741



##########
File path: 
buildSrc/src/main/java/org/apache/geode/gradle/testing/isolation/WorkingDirectoryIsolator.java
##########
@@ -65,6 +69,21 @@ public void accept(ProcessBuilder processBuilder) {
     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);
+  }
+
+  /**
+   * Replace all occurrences of "../" that are not proceeded by a / in the 
command with "../../"
+   * to match the new working directory of the process. This fixes issues with 
java agent commands
+   * like jacoco that pass relative paths, eg 
"-agentlib:../tmp/jacocoXXX=../jacoco/test.txt
+   * @param command the commmand line to upgrade. It will be modified in place.
+   */
+  private void upgradeRelativePaths(List<String> command) {
+    for(int i =0 ; i < command.size(); i++) {
+      command.set(i, command.get(i).replaceAll( "(?<!/)\\.\\./", "../../"));
+    }

Review comment:
       Will this work on Windows? Please add the `windows` label to this PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to