@@ -83,7 +83,6 @@ module Stack.Prelude
83
83
, vsep
84
84
) where
85
85
86
- import Conduit
87
86
import Data.Monoid as X
88
87
( Any (.. ), Endo (.. ), First (.. ), Sum (.. ) )
89
88
import Data.Conduit as X ( ConduitM , runConduit , (.|) )
@@ -125,10 +124,8 @@ import RIO.Process
125
124
, workingDirL
126
125
)
127
126
import qualified RIO.Text as T
128
- import System.Permissions (osIsWindows )
129
127
import System.IO.Echo ( withoutInputEcho )
130
128
131
-
132
129
-- | Path version
133
130
withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a ) -> m a
134
131
withSystemTempDir str inner = withRunInIO $ \ run ->
@@ -303,24 +300,10 @@ defaultFirstFalse :: (a -> FirstFalse) -> Bool
303
300
defaultFirstFalse _ = False
304
301
305
302
-- | Write a @Builder@ to a file and atomically rename.
306
- --
307
- -- In the future: replace with a function in rio
308
303
writeBinaryFileAtomic :: MonadIO m => Path absrel File -> Builder -> m ()
309
- writeBinaryFileAtomic fp builder
310
- -- Atomic file writing is not supported on Windows yet, unfortunately.
311
- -- withSinkFileCautious needs to be implemented properly for Windows to make
312
- -- this work.
313
- | osIsWindows =
314
- liftIO $
315
- withBinaryFile (toFilePath fp) WriteMode $ \ h ->
316
- hPutBuilder h builder
317
- | otherwise =
318
- liftIO $
319
- withSinkFileCautious (toFilePath fp) $ \ sink ->
320
- runConduit $
321
- yield builder .|
322
- unsafeBuilderToByteString .|
323
- sink
304
+ writeBinaryFileAtomic fp builder =
305
+ liftIO $
306
+ withBinaryFileAtomic (toFilePath fp) WriteMode (`hPutBuilder` builder)
324
307
325
308
newtype PrettyRawSnapshotLocation
326
309
= PrettyRawSnapshotLocation RawSnapshotLocation
0 commit comments