diff --git a/src/TemporaryDirectory.php b/src/TemporaryDirectory.php index 13a9295..039928a 100644 --- a/src/TemporaryDirectory.php +++ b/src/TemporaryDirectory.php @@ -161,6 +161,10 @@ protected function deleteDirectory(string $path): bool } } + /* + * By forcing a php garbage collection cycle using gc_collect_cycles() we can ensure + * that the rmdir does not fail due to files still being reserved in memory. + */ gc_collect_cycles(); return rmdir($path);