hsc2hs: Make removeFile more reliable on Windows.#25
hsc2hs: Make removeFile more reliable on Windows.#25RyanGlScott merged 5 commits intohaskell:masterfrom
Conversation
RyanGlScott
left a comment
There was a problem hiding this comment.
Thanks, @Mistuke! I've left some suggestions inline.
Bumping the lower version bounds of process poses an interesting question with respect to hsc2hs's support window, since this patch requires a more recent version of process than what many versions of GHC are shipped with. @hvr, what are your thoughts on this?
Yeah, I thought it would be OK since the newer version of process should have been usable on older GHCs as well, but the CI proved me wrong here. I could instead do a soft bump. e.g. if an |
|
Thanks for the review! I'll wait for what to do with the version bounds and will update the PR. |
The CI can be a little misleading in this regard, as it's specifically configured to use the version of What's more troublesome is the fact that the oldest version to actually be bundled with a sufficiently new version of |
|
I talked with @hvr on IRC about this, and he would like to keep supporting build plans with old versions of if os(windows)
process >= 1.5And then guarding the use of |
|
Thanks @RyanGlScott , I will update the PR tomorrow. Cheers. |
|
Opened a request at directory haskell/directory#96 |
RyanGlScott
left a comment
There was a problem hiding this comment.
The build finally passes, yay!
Do you mind adding a brief summary of these changes to the changelog.md? Thanks!
Also, one more inline comment.
|
Great! Just add a mention of these changes to |
|
Right, sorry about that. completely forgot about the changelog... Too much to do :( |
|
No worries. Thanks for fixing this, @Mistuke! |
This makes errors such as those in https://gitlab.haskell.org/ghc/ghc/issues/9775#note_203453 a lot rarer.
It does this by using two things:
It uses a process API that on Windows causes
waitForProcessto wait for all child processes to complete. This is required because the tools thathsc2hsuse callexecwhich does not behave as you would expect on Windows. The parent will return before the child finishes and so you have a race condition. On other OSes this flag has no effect.It implements a retry queue which tries to delete a file 6 times if it's a permission error that prevented you from deleting it. This because the temp file could be locked by an AV for scanning. The total wait time is ~3secs.