Open femshima opened 1 year ago
I guess it's a limitation of Windows. The best thing we can do is try to avoid doing any kind of asynchronous file IO, which isn't supported anyway in this situation. The simple solution is to just detect windows and skip any kind of asynchronous io_read
and io_write
operations.
Then I'll just try detecting Windows and avoid async file IO on it...
Thank you for your comment and advice. I'm closing this issue.
Async on Windows is a work in progress. The first part was to get io-event
working which is tested, but async itself is not well tested on Windows yet. We should probably disable the io_read
and io_write
hooks on Windows for this reason. I want to leave this issue open until we do that.
https://github.com/socketry/async/pull/184 now includes the above.
Description
When I use File.read in Async, the following exception is thrown.
This behavior is only observed in Windows with ruby 3.1.
Also, I reproduced this behavior in GitHub Actions here.
Sample Code
Expected Behavior
No exception is thrown, and the content of
README.md
is shown on console.Actual Behavior
Errno::EBADF: Bad file descriptor
exception is thrown, and the task stops there.Versions
Windows 10 Home 21H2 ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt] async (2.3.0)