Make openFile more tolerant of async excs (#18832)
Fixes #18832
The repro [1] fails on linux with "file locked" and on osx with "too many open files". I don't know where the difference comes from, but the fix prevents a failure on both systems.
[1] https://github.com/luntain/misc/blob/master/Repro2.hs
Please read the checklist below to make sure your contribution fulfills these expectations. Also please answer the following question in your MR description:
Where is the key part of this patch? That is, what should reviewers look at first? kamil: N/A, the patch is small
Please take a few moments to verify that your commits fulfill the following:
-
are either individually buildable or squashed -
have commit messages which describe what they do (referring to Notes and tickets using #NNNN
syntax when appropriate) -
have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places. -
add a testcase to the testsuite. -
if your MR affects library interfaces (e.g. changes base
) or affects whether GHC will accept user-written code, please add the ~"user facing" label. -
updates the users guide if applicable -
mentions new features in the release notes for the next release (kamil: mentioned in release notes for libraries)