Broken Pipe error on windows should just be end of stream.

This commit is contained in:
Calvin Rose 2020-11-14 16:03:51 -06:00
parent dc51bd09f7
commit d199c817dc
1 changed files with 5 additions and 1 deletions

View File

@ -1253,7 +1253,11 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) {
{
status = ReadFile(s->stream->handle, state->chunk_buf, chunk_size, NULL, &state->overlapped);
if (!status && (ERROR_IO_PENDING != WSAGetLastError())) {
janet_cancel(s->fiber, janet_ev_lasterr());
if (WSAGetLastError() == ERROR_BROKEN_PIPE) {
janet_schedule(s->fiber, janet_wrap_nil());
} else {
janet_cancel(s->fiber, janet_ev_lasterr());
}
return JANET_ASYNC_STATUS_DONE;
}
}