@@ -5,6 +5,7 @@ module NixDaemonSpec
55 , spec
66 ) where
77
8+ import Control.Exception (catch , SomeException )
89import Control.Monad (forM_ , unless , void )
910import Control.Monad.Catch (MonadMask )
1011import Control.Monad.Conc.Class (MonadConc )
@@ -465,13 +466,16 @@ makeProtoSpec f flavor = around f $ do
465466 -- clear temp gc roots so the delete works. restarting the nix daemon should also do this...
466467 storeDir <- getStoreDir
467468 let tempRootsDir = Data.Text. unpack $ mconcat [ Data.Text.Encoding. decodeUtf8 (unStoreDir storeDir), " /../var/nix/temproots/" ]
468- tempRootList <-
469- liftIO
470- $ System.Directory. listDirectory
471- tempRootsDir
472- liftIO $ forM_ tempRootList $ \ entry -> do
473- System.Directory. removeFile
474- $ mconcat [ tempRootsDir, " /" , entry ]
469+ liftIO $ do
470+ tempRootList <-
471+ System.Directory. listDirectory tempRootsDir
472+ forM_ tempRootList $ \ entry -> do
473+ System.Directory. removeFile
474+ $ mconcat [ tempRootsDir, " /" , entry ]
475+ -- for MITM, the temp root might get deleted
476+ -- by the daemon as our nested client exists
477+ -- causing TOC/TOU flakiness
478+ `catch` (\ (_e :: SomeException ) -> pure () )
475479
476480 GCResult {.. } <-
477481 collectGarbage
0 commit comments