1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-24 20:27:41 +00:00

Add more network and subprocess testing with redirection.

This commit is contained in:
Calvin Rose
2021-01-11 18:32:56 -06:00
parent bf01bf631d
commit 5e1a8c86f9
3 changed files with 50 additions and 8 deletions

View File

@@ -1560,7 +1560,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())) {
if (WSAGetLastError() == ERROR_BROKEN_PIPE) {
janet_schedule(s->fiber, janet_wrap_nil());
if (state->bytes_read) {
janet_schedule(s->fiber, janet_wrap_buffer(state->buf));
} else {
janet_schedule(s->fiber, janet_wrap_nil());
}
} else {
janet_cancel(s->fiber, janet_ev_lasterr());
}