mirror of
https://github.com/janet-lang/janet
synced 2025-01-13 00:50:26 +00:00
Merge pull request #908 from ishehadeh/master
Windows: Fix `ev/read` hanging when called on stream from `os/open`
This commit is contained in:
commit
ab53208f47
@ -2219,6 +2219,10 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Some handles (not all) read from the offset in lopOverlapped
|
||||
// if its not set before calling `ReadFile` these streams will always read from offset 0
|
||||
state->overlapped.Offset = (DWORD) state->bytes_read;
|
||||
|
||||
status = ReadFile(s->stream->handle, state->chunk_buf, chunk_size, NULL, &state->overlapped);
|
||||
if (!status && (ERROR_IO_PENDING != WSAGetLastError())) {
|
||||
if (WSAGetLastError() == ERROR_BROKEN_PIPE) {
|
||||
|
Loading…
Reference in New Issue
Block a user