Skip to content
Snippets Groups Projects
Commit 50e8ff95 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 53e56383
No related merge requests found
...@@ -93,6 +93,7 @@ import Distribution.Version (Version(..), readVersion, showVersion, ...@@ -93,6 +93,7 @@ import Distribution.Version (Version(..), readVersion, showVersion,
import Distribution.Verbosity import Distribution.Verbosity
import System.Directory (doesFileExist, removeFile) import System.Directory (doesFileExist, removeFile)
import System.FilePath (dropExtension) import System.FilePath (dropExtension)
import System.IO.Error (try)
import Control.Monad (join, foldM) import Control.Monad (join, foldM)
import Control.Exception as Exception (catch) import Control.Exception as Exception (catch)
...@@ -564,7 +565,7 @@ hsc2hsProgram = (simpleProgram "hsc2hs") { ...@@ -564,7 +565,7 @@ hsc2hsProgram = (simpleProgram "hsc2hs") {
withTempFile "." "hsc" $ \hsc -> do withTempFile "." "hsc" $ \hsc -> do
writeFile hsc "" writeFile hsc ""
(str, _) <- rawSystemStdout' verbosity path [hsc, "--cflag=--version"] (str, _) <- rawSystemStdout' verbosity path [hsc, "--cflag=--version"]
removeFile (dropExtension hsc ++ "_hsc_make.c") try $ removeFile (dropExtension hsc ++ "_hsc_make.c")
case words str of case words str of
(_:"Glorious":"Glasgow":"Haskell":_) (_:"Glorious":"Glasgow":"Haskell":_)
-> return $ Just version { versionTags = ["ghc"] } -> return $ Just version { versionTags = ["ghc"] }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment