Commit 32432f3f authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Close the package.conf file after reading it

We had a bug on windows where we open and read ghc's package.conf
database but because we did not consume the final newline we did
not close the file. Then when we called ghc-pkg to register a
package it failed because it could not rename the open file.
parent 83523919
......@@ -324,7 +324,7 @@ getInstalledPackages' verbosity packagedbs conf = do
(SpecificPackageDB specific, _) -> return $ Just specific
_ -> die "cannot read ghc-pkg package listing"
pkgFiles' <- mapM dbFile packagedbs
sequence [ do content <- readFile file
sequence [ withFileContents file $ \content ->
case reads content of
[(pkgs, _)] -> return (db, pkgs)
_ -> die $ "cannot read ghc package database " ++ file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment