From 8bba47e47c55071ada5309301e9e119c9a35172e Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Wed, 1 Jan 2025 01:24:41 +0100 Subject: [PATCH] recursively delete game directory --- junit/src/main/java/net/neoforged/fml/junit/JUnitService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/junit/src/main/java/net/neoforged/fml/junit/JUnitService.java b/junit/src/main/java/net/neoforged/fml/junit/JUnitService.java index a9f74ef5..956e0bf9 100644 --- a/junit/src/main/java/net/neoforged/fml/junit/JUnitService.java +++ b/junit/src/main/java/net/neoforged/fml/junit/JUnitService.java @@ -68,6 +68,9 @@ public void launcherSessionClosed(LauncherSession session) { var current = FMLLoader.currentOrNull(); if (current != null) { current.close(); + // This is a slightly desparate attempt, but module loaders cannot be closed explicitly. + // Instead, they have to be garbage collected to close the underlying Jar file. + System.gc(); } if (gameDir != null) {