File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ import qualified System.Environment as IO
148148import qualified System.Info as IO
149149import qualified System.IO as IO
150150import qualified System.IO.Temp as IO
151+ import qualified System.Timeout as IO
151152
152153{- HLINT ignore "Reduce duplication" -}
153154
@@ -208,17 +209,19 @@ workspace prefixPath f =
208209 => FilePath
209210 -> Int
210211 -> m ()
211- removeWorkspaceRetries ws retries = GHC. withFrozenCallStack $ do
212- result <- try (liftIO (IO. removePathForcibly ws))
213- case result of
214- Right () -> return ()
215- Left (_ :: IOException ) -> do
216- if retries > 0
217- then do
218- liftIO (IO. threadDelay 100000 ) -- wait 100ms before retrying
219- removeWorkspaceRetries ws (retries - 1 )
220- else do
221- failMessage GHC. callStack " Failed to remove workspace directory after multiple attempts"
212+ removeWorkspaceRetries ws retries =
213+ GHC. withFrozenCallStack $ do
214+ result <- try (liftIO (IO. timeout (5 * 1000 ) (IO. removePathForcibly ws)))
215+ case result of
216+ Right (Just () ) -> return ()
217+ Right Nothing -> pure ()
218+ Left (_ :: IOException ) -> do
219+ if retries > 0
220+ then do
221+ liftIO (IO. threadDelay 100000 ) -- wait 100ms before retrying
222+ removeWorkspaceRetries ws (retries - 1 )
223+ else do
224+ failMessage GHC. callStack " Failed to remove workspace directory after multiple attempts"
222225
223226
224227-- | Create a workspace directory which will exist for at least the duration of
You can’t perform that action at this time.
0 commit comments