Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cabal-syntax/src/Distribution/Utils/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ renameFileWithRetry srcPath targetPath =
-- UnsupportedOperation means EXDEV from rename(2) with source and target
-- on different devices. In such case we resort to copying instead of renaming.
| ioeGetErrorType exception == UnsupportedOperation =
copyFile srcPath targetPath `Exception.catch` retryCopy (retriesLeft - 1)
retryCopy retriesLeft exception
| otherwise = do
-- Wait 1ms between retries: maybe device is busy, maybe antivirus locked srcPath.
threadDelay 1000
Expand All @@ -217,7 +217,7 @@ renameFileWithRetry srcPath targetPath =
retryCopy retriesLeft _ = do
-- Wait 1ms between retries: maybe device is busy, maybe antivirus locked srcPath.
threadDelay 1000
copyFile srcPath targetPath `Exception.catch` retryCopy retriesLeft
copyFile srcPath targetPath `Exception.catch` retryCopy (retriesLeft - 1)
-- It's nice to clean up, but not critical, so ignoring any exceptions.
removeFile srcPath `Exception.catch` (\(_ :: IOException) -> pure ())

Expand Down
Loading