Forked from
Reproducible Builds / diffoscope
Source project has a limited visibility.
-
Previously the temporary directories where all left in place until the end of the process, when a massive cleanup was being run. The cause was the _DIRS variable that was holding references to the TemporaryDirectory objects, so their destructor was not running. We now remove the _DIRS list completely (replacing it with _BASEDIR for storing only the parent temporary directory). As a result, the temporary directories and their contents are being cleaned up automatically when the class destructor runs. This in turn requires modifications to preexisting code: 1. Code that was directly using `get_temporary_directory().name` stopped working; the object from `get_temporary_directory()` needs to be referenced directly to keep it alive. 2. `get_temporary_directory()` is now starting a `with` block (context manager) where it was straightforward.
Previously the temporary directories where all left in place until the end of the process, when a massive cleanup was being run. The cause was the _DIRS variable that was holding references to the TemporaryDirectory objects, so their destructor was not running. We now remove the _DIRS list completely (replacing it with _BASEDIR for storing only the parent temporary directory). As a result, the temporary directories and their contents are being cleaned up automatically when the class destructor runs. This in turn requires modifications to preexisting code: 1. Code that was directly using `get_temporary_directory().name` stopped working; the object from `get_temporary_directory()` needs to be referenced directly to keep it alive. 2. `get_temporary_directory()` is now starting a `with` block (context manager) where it was straightforward.