strict file IO for make

This commit is contained in:
boy 2006-03-31 13:32:46 +00:00
parent 33c374fb75
commit 493be17566

View File

@ -66,9 +66,9 @@ import System.Plugins.Env ( lookupMerged, addMerge
, getModuleDeps) , getModuleDeps)
#if DEBUG #if DEBUG
import System.IO (hFlush, stdout, openFile, IOMode(..),hClose, hPutStr) import System.IO (hFlush, stdout, openFile, IOMode(..),hClose, hPutStr, hGetContents)
#else #else
import System.IO (openFile, IOMode(..),hClose,hPutStr) import System.IO (openFile, IOMode(..),hClose,hPutStr, hGetContents)
#endif #endif
import System.Directory ( doesFileExist, removeFile import System.Directory ( doesFileExist, removeFile
@ -391,8 +391,8 @@ rawMerge src stb out always_merge = do
;if not do_merge && not always_merge ;if not do_merge && not always_merge
then return $ MergeSuccess NotReq [] out then return $ MergeSuccess NotReq [] out
else do else do
src_str <- readFile src src_str <- readFile' src
stb_str <- readFile stb stb_str <- readFile' stb
let (a,a') = parsePragmas src_str let (a,a') = parsePragmas src_str
(b,b') = parsePragmas stb_str (b,b') = parsePragmas stb_str
@ -441,3 +441,10 @@ rm_f f = handleJust doesntExist (\_->return ()) (removeFile f)
| otherwise = Nothing | otherwise = Nothing
doesntExist _ = Nothing doesntExist _ = Nothing
readFile' f = do
h <- openFile f ReadMode
s <- hGetContents h
length s `seq` return ()
hClose h
return s