foliage: Force FileInfo

Unfortunately hackage-security constructs these using lazy bytestrings
and they are therefore liable to hold open fds longer than necessary,
resulting in fd exhaustion.

Fixes another manifestation of #35.
This commit is contained in:
Ben Gamari 2023-06-15 11:16:59 -04:00
parent a938062863
commit 1cc2db12ac

View File

@ -32,10 +32,14 @@ readJSONSimple fp = do
p <- makeAbsolute (fromFilePath fp)
readJSON_NoKeys_NoLayout p
forceFileInfo :: FileInfo -> ()
forceFileInfo (FileInfo a b) = a `seq` b `seq` ()
computeFileInfoSimple :: FilePath -> IO FileInfo
computeFileInfoSimple fp = do
p <- makeAbsolute (fromFilePath fp)
computeFileInfo p
fi <- computeFileInfo p
return $! forceFileInfo fi `seq` fi
createKeys :: FilePath -> IO ()
createKeys base = do