Handle converted from Fd with fdToHandle contains nothing
Closed this issue · 1 comments
AleXoundOS commented
Is fdToHandle
supposed to work with the file descriptor, returned by memFdCreate
?
I can be wrong but it seems that the returned Fd
is not the proper Fd
haskell knows of. Perhaps it should be created with mkFd
?
Also, despite fdWrite
works, fdRead
not - throws EOF exception:
fd <- memFdCreate "test" []
fdWrite fd "Test text"
fdRead fd 1
*** Exception: fdRead: end of file (EOF)
AleXoundOS commented
Sorry for my poor knowledge of file descriptors. Solution is to run this before reading from the beginning:
fdSeek fd AbsoluteSeek 0
Both fdRead
and fdToHandle
work then.