Fix windows tempfile handling
On Windows, `ghc-mod lint` fails with following message. ghc-mod: DeleteFile "<Ommit>\\Temp\\ghc-mod-hlint8464": permission denied <Ommit> Perhaps, On Windows, GHC opens file exclusively. So, we move `removeFile` to `finally`.
This commit is contained in:
parent
abb9ecd8ac
commit
0eadfa91fd
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user