Skip to content

Commit bb26b0c

Browse files
committed
synchronise atomic locking with commercialhaskell/release
breaks WSL1 and removes the original reason this fork exists
1 parent bef86b4 commit bb26b0c

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

src/Stack/Prelude.hs

+3-20
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ module Stack.Prelude
8383
, vsep
8484
) where
8585

86-
import Conduit
8786
import Data.Monoid as X
8887
( Any (..), Endo (..), First (..), Sum (..) )
8988
import Data.Conduit as X ( ConduitM, runConduit, (.|) )
@@ -125,10 +124,8 @@ import RIO.Process
125124
, workingDirL
126125
)
127126
import qualified RIO.Text as T
128-
import System.Permissions (osIsWindows)
129127
import System.IO.Echo ( withoutInputEcho )
130128

131-
132129
-- | Path version
133130
withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a
134131
withSystemTempDir str inner = withRunInIO $ \run ->
@@ -303,24 +300,10 @@ defaultFirstFalse :: (a -> FirstFalse) -> Bool
303300
defaultFirstFalse _ = False
304301

305302
-- | Write a @Builder@ to a file and atomically rename.
306-
--
307-
-- In the future: replace with a function in rio
308303
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)
324307

325308
newtype PrettyRawSnapshotLocation
326309
= PrettyRawSnapshotLocation RawSnapshotLocation

stack.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ nix:
3838
- unzip
3939

4040
flags:
41-
lukko:
42-
ofd-locking: false
4341
hackage-security:
4442
Cabal-syntax: true
4543
mintty:

0 commit comments

Comments
 (0)