Commit 252607b5 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Use 'openBinaryTempFile' instead of 'openTempFile'

On some architectures 'openTempFile' converts new-line symbols.
While the difference probably manifests only on Windows machines, we
should use the proper semantics anyway.
Signed-off-by: default avatarPetr Pudlak <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 6dfcf3b6
......@@ -61,8 +61,8 @@ atomicWriteFile path contents = atomicUpdateFile path
atomicUpdateFile :: (MonadBaseControl IO m)
=> FilePath -> (FilePath -> Handle -> m a) -> m a
atomicUpdateFile path action = do
(tmppath, tmphandle) <- liftBase $ openTempFile (takeDirectory path)
(takeBaseName path)
(tmppath, tmphandle) <- liftBase $ openBinaryTempFile (takeDirectory path)
(takeBaseName path)
r <- L.finally (action tmppath tmphandle)
(liftBase $ hCloseAndFsync tmphandle)
-- if all went well, rename the file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment