|
5 | 5 | {-# LANGUAGE FlexibleInstances #-} |
6 | 6 | {-# LANGUAGE GADTs #-} |
7 | 7 | {-# LANGUAGE LambdaCase #-} |
8 | | -{-# LANGUAGE NumericUnderscores #-} |
9 | 8 | {-# LANGUAGE OverloadedStrings #-} |
10 | 9 | {-# LANGUAGE ScopedTypeVariables #-} |
11 | 10 |
|
@@ -44,7 +43,7 @@ import GHC.Stack |
44 | 43 | import qualified GHC.Stack as GHC |
45 | 44 | import Network.Socket (HostAddress, PortNumber) |
46 | 45 | import Prettyprinter (unAnnotate) |
47 | | -import RIO (runRIO, threadDelay) |
| 46 | +import RIO (runRIO) |
48 | 47 | import qualified System.Directory as IO |
49 | 48 | import System.FilePath |
50 | 49 | import qualified System.IO as IO |
@@ -253,16 +252,7 @@ startNode tp node ipv4 port _testnetMagic nodeCmd = GHC.withFrozenCallStack $ do |
253 | 252 | createDirectoryIfMissingNew :: HasCallStack => FilePath -> IO FilePath |
254 | 253 | createDirectoryIfMissingNew directory = GHC.withFrozenCallStack $ do |
255 | 254 | IO.createDirectoryIfMissing True directory |
256 | | - exists <- IO.doesDirectoryExist directory |
257 | | - if exists |
258 | | - then pure directory |
259 | | - else do |
260 | | - threadDelay 5_000_000 |
261 | | - IO.createDirectoryIfMissing True directory |
262 | | - exists' <- IO.doesDirectoryExist directory |
263 | | - if exists' |
264 | | - then pure directory |
265 | | - else throwString $ "Failed to create directory: " <> directory |
| 255 | + pure directory |
266 | 256 |
|
267 | 257 |
|
268 | 258 | createSubdirectoryIfMissingNew :: () |
@@ -343,8 +333,15 @@ startLedgerNewEpochStateLogging testnetRuntime tmpWorkspace = withFrozenCallStac |
343 | 333 | -- | Handle all sync exceptions and log them into the log file. We don't want to fail the test just |
344 | 334 | -- because logging has failed. |
345 | 335 | handleException = handle $ \(e :: SomeException) -> do |
346 | | - liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n" |
347 | | - <> displayException e <> "\n" |
| 336 | + exists <- liftIO $ IO.doesFileExist outputFp |
| 337 | + if exists |
| 338 | + then liftIO $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n" |
| 339 | + <> displayException e <> "\n" |
| 340 | + else |
| 341 | + liftIO $ writeFile outputFp $ unlines |
| 342 | + ["Ledger new epoch logging failed - caught exception:" |
| 343 | + , displayException e |
| 344 | + ] |
348 | 345 | pure ConditionMet |
349 | 346 |
|
350 | 347 | calculateEpochStateDiff |
|
0 commit comments