-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support openTempFile and friends, fixes #2 #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, no idea what’s up with Windows CI job though.
It's suspicious. It also seems to be flaky. |
Any idea why these concurrency tests would sometimes fail on windows? I can not reproduce in my windows VM. |
_ <- OSP.openFile fp ReadMode Is this intended to create a dangling handle? Genreally I would be a bit wary of writing a standalone statement in a garbage-collected language since there may or may not be a finalizer that releases the handle automatically if it goes unused. Maybe someone familiar with the implementation details of |
Yeah, it might be worth to try something like !h <- OSP.openFile fp ReadMode
r <- try @IOException $ OSP.withFile fp WriteMode $ \h' -> do BS.hPut h' "test"
BS.hPut h "should have failed before" |
We always add a finalizer to any handle you create. But the intention there is usually to make sure we don't leak resources. The RTS will invoke all finalizers before terminating. But when the finalizer run is non-deterministic. We only guarantee that it will run by the time you shutdown. I think @Bodigrim 's solution is correct for the tests that check if the file is locked, and for the ones that check if you can read it you need |
This is released as |
Also see: haskell/directory#182
TODO:
@Rufflewind