Test that the file exists one last time on exit.
MODIFY
src/main/java/org/apache/commons/io/file/PathUtils.java
src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -1107,7 +1107,7 @@ public static boolean waitFor(final Path file, final Duration timeout, LinkOptio
Thread.currentThread().interrupt();
}
}
- return true;
+ return Files.exists(file, options);
}
/**

MODIFY
src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
@@ -48,7 +48,7 @@ public void testWaitForInterrupted() throws InterruptedException {
final CountDownLatch started = new CountDownLatch(1);
final Thread thread1 = new Thread(() -> {
started.countDown();
- FileUtils.waitFor(FileUtils.current(), 2);
+ assertTrue(FileUtils.waitFor(FileUtils.current(), 4));
wasInterrupted.set(Thread.currentThread().isInterrupted());
});
thread1.start();

Test that the file exists one last time on exit.