Commit d97301b5 authored by Ross Paterson's avatar Ross Paterson
Browse files

don't fail if xxx_hsc_make.c is gone

The non-GHC hsc2hs deletes it even if the compilation fails.
parent c69ea20b
......@@ -93,6 +93,7 @@ import Distribution.Version (Version(..), readVersion, showVersion,
import Distribution.Verbosity
import System.Directory (doesFileExist, removeFile)
import System.FilePath (dropExtension)
import System.IO.Error (try)
import Control.Monad (join, foldM)
import Control.Exception as Exception (catch)
......@@ -564,7 +565,7 @@ hsc2hsProgram = (simpleProgram "hsc2hs") {
withTempFile "." "hsc" $ \hsc -> do
writeFile hsc ""
(str, _) <- rawSystemStdout' verbosity path [hsc, "--cflag=--version"]
removeFile (dropExtension hsc ++ "_hsc_make.c")
try $ removeFile (dropExtension hsc ++ "_hsc_make.c")
case words str of
(_:"Glorious":"Glasgow":"Haskell":_)
-> return $ Just version { versionTags = ["ghc"] }
......
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