You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider a variant of deleteFile that on Windows retries x times before giving up #96
As discussed in haskell/hsc2hs#25 there are various services on Windows that can keep a file open for a fraction of time, such as indexer or AV services. That means that deleteFile may fail temporarily.
It's not a very elegant solution, but I guess it's kind of needed on Windows. I would suggest making a somewhat generic retry function if possible, as there are many variants of removeFileThing:
Yes, it's used in GHC, hsc2hs, cabal and GHC's testsuite. So it would allow us to align those implementations and I believe it's useful for third parties as well. But I honestly don't know when I would personally have the time to implement this.
retryOnPermissionError :: {- numRetries -} Int -> IO a -> IO a
I think the wording is problematic. Afais, the exceptions to retry on are ERROR_LOCK_VIOLATION and ERROR_SHARING_VIOLATION, which are very specific. And we don't know if that will change or if there are more use cases for this for some users. Code-paths that rely on exception types are very very fragile.
I would go so far to say this doesn't belong in this library, but is a generic exception handling function and already exists in various forms, such as retryBool.
The documentation of removeFile should simply document this behavior. That's what the python sdtlib does as well.
I'm inclined to agree with @hasufell that this might be getting a bit out of scope for this library. A general retry function probably belongs to System.IO.Exception or similar.
Closing this issue for now. Let me know if there are any concerns.
Activity
Rufflewind commentedon Jun 22, 2019
It's not a very elegant solution, but I guess it's kind of needed on Windows. I would suggest making a somewhat generic retry function if possible, as there are many variants of
removeFileThing:Rufflewind commentedon Nov 12, 2019
Is there still interest in this feature?
Mistuke commentedon Nov 13, 2019
Yes, it's used in GHC, hsc2hs, cabal and GHC's testsuite. So it would allow us to align those implementations and I believe it's useful for third parties as well. But I honestly don't know when I would personally have the time to implement this.
hasufell commentedon Jan 9, 2020
I think the wording is problematic. Afais, the exceptions to retry on are
ERROR_LOCK_VIOLATIONandERROR_SHARING_VIOLATION, which are very specific. And we don't know if that will change or if there are more use cases for this for some users. Code-paths that rely on exception types are very very fragile.I would go so far to say this doesn't belong in this library, but is a generic exception handling function and already exists in various forms, such as retryBool.
The documentation of
removeFileshould simply document this behavior. That's what the python sdtlib does as well.Rufflewind commentedon Feb 14, 2020
I'm inclined to agree with @hasufell that this might be getting a bit out of scope for this library. A general retry function probably belongs to
System.IO.Exceptionor similar.Closing this issue for now. Let me know if there are any concerns.
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Try delete multiple times on windows
Rufflewind commentedon Jul 19, 2020
It looks like there's an algorithm for deleting directories on Windows without the need for retries: #110