Dirs created by GHC.Utils.TmpFs.newTempDir cannot be removed
GHC.Utils.TmpFs.newTempDir
creates a new ghc_N
subdirectory in a temp directory, but this directory cannot be removed. The result is a warning at the end of the GHC run.
It's not possible to clean this ghc_N
subdirectory using addFilesToClean
:
-
addFilesToClean
usesremoveFile
and fails for directories - the to-clean list is kept in a
Set FilePath
and doesn't preserve the order in which the files were added, so a dir could potentially be removed before the files contained in it.
I've come up with two ideas to fix it
- when removing a top-level ghc temp dir, automatically remove empty
ghc_N
subdirs inside it (incleanTempDirs
) - keep track of all created
ghc_N
bynewTempDir
and remove them as the first step incleanTempDirs
Any preferences or other ideas?
Edited by Luite Stegeman