Skip to content
Snippets Groups Projects
Commit 4fcec21e authored by judah's avatar judah
Browse files

Fix ghc issue #3258: don't leave an a.out file in the current directory when...

Fix ghc issue #3258: don't leave an a.out file in the current directory when configure checks for iconv.
parent 932fb18e
No related branches found
No related tags found
No related merge requests found
......@@ -72,11 +72,14 @@ hasFlagSet cflags flag = Just True == lookup flag (configConfigurationsFlags cfl
tryCompile :: String -> BuildInfo -> LocalBuildInfo -> Verbosity -> IO Bool
tryCompile program bi lbi verb = handle processExit $ handle processException $ do
tempDir <- getTemporaryDirectory
withTempFile tempDir ".c" $ \fname h -> do
hPutStr h program
hClose h
withTempFile tempDir ".c" $ \fname cH ->
withTempFile tempDir "" $ \execName oH -> do
hPutStr cH program
hClose cH
hClose oH
-- TODO take verbosity from the args.
rawSystemProgramStdoutConf verb gccProgram (withPrograms lbi) (fname : args)
rawSystemProgramStdoutConf verb gccProgram (withPrograms lbi)
(fname : "-o" : execName : args)
return True
where
processException :: IOException -> IO Bool
......
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