Merge pull request #221 from satoshi-murakumo/fix-windows-tempfile-handling

Fix windows tempfile handling
This commit is contained in:
Kazu Yamamoto 2014-04-17 09:20:10 +09:00
commit 68f64639dc

View File

@ -31,8 +31,9 @@ suppressStdout :: IO a -> IO a
suppressStdout f = do
tmpdir <- getTemporaryDirectory
(path, handle) <- openTempFile tmpdir "ghc-mod-hlint"
removeFile path
dup <- hDuplicate stdout
hDuplicateTo handle stdout
hClose handle
f `finally` hDuplicateTo dup stdout
f `finally` do
hDuplicateTo dup stdout
removeFile path