I’ve found a few different ways to wait on a file until data is available to read. Of the methods I’ve found,
poll_fd seems to match my use case well, but I worry that it requires the use of
RawFD, which only appears in the docs once so I’m not sure I’m using it right or should be using it.
f=open("test","w");poll_fd(RawFD(fd(f)),1;readable=true) seems to work (0.5.0 on MacOS), is there anything wrong with that usage?
This seems like a good topic for an issue/pr related to improved docs, agreed?
PS: For what it’s worth, here are the other methods I found:
- the docs says it “If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. Note that not all stream types support the all option.” This call returns immediately with an empty array, so I guess files on MacOS don’t support the all option?