Safe Haskell | None |
---|---|
Language | Haskell2010 |
Distribution.Utils.TempTestDir
Synopsis
- withTestDir :: Verbosity -> String -> (FilePath -> IO a) -> IO a
- removeDirectoryRecursiveHack :: Verbosity -> FilePath -> IO ()
Documentation
withTestDir :: Verbosity -> String -> (FilePath -> IO a) -> IO a Source #
Much like withTemporaryDirectory
but with a number of hacks to make
sure on windows that we can clean up the directory at the end.
removeDirectoryRecursiveHack :: Verbosity -> FilePath -> IO () Source #
On Windows, file locks held by programs we run (in this case VCSs) are not always released prior to completing process termination! https://msdn.microsoft.com/en-us/library/windows/desktop/aa365202.aspx This means we run into stale locks when trying to delete the test directory. There is no sane way to wait on those locks being released, we just have to wait, try again and hope.
In addition, on Windows a file that is not writable also cannot be deleted, so we must try setting the permissions to readable before deleting files. Some VCS tools on Windows create files with read-only attributes.