Copilot commented on code in PR #3656:
URL: https://github.com/apache/maven-surefire/pull/3656#discussion_r4764929975
##########
surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java:
##########
@@ -64,9 +64,11 @@ public static void setSystemProperties(File file) throws
IOException {
public static File writePropertiesFile(
Properties properties, File tempDirectory, String name, boolean
keepForkFiles) throws IOException {
- File file =
TempFileManager.instance(tempDirectory).createTempFile(name, "tmp");
+ TempFileManager tempFiles = TempFileManager.instance(tempDirectory);
+ File file = tempFiles.createTempFile(name, "tmp");
if (!keepForkFiles) {
- file.deleteOnExit();
+ // like File.deleteOnExit(), but the file is forgotten once the
fork has deleted it
+ tempFiles.setDeleteOnExit(true);
Review Comment:
If calls with `keepForkFiles=false` and `keepForkFiles=true` share a
directory, this directory-wide flag causes the retained files to be deleted at
JVM shutdown too. Track shutdown deletion per file in `TempFileManager`,
removing that registration after successful deletion, so cleanup preserves each
file's retention policy. The same issue affects
`JarManifestForkConfiguration.java:139` and
`ModularClasspathForkConfiguration.java:148`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]