Skip to content

Commit

Permalink
don't fail if xxx_hsc_make.c is gone
Browse files Browse the repository at this point in the history
The non-GHC hsc2hs deletes it even if the compilation fails.
  • Loading branch information
Ross Paterson committed Oct 18, 2007
1 parent 53e5638 commit 50e8ff9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Distribution/Simple/Program.hs
Expand Up @@ -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)

Expand Down Expand Up @@ -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"] }
Expand Down

0 comments on commit 50e8ff9

Please sign in to comment.