mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +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:
		| @@ -2219,6 +2219,10 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) { | |||||||
|             } else |             } else | ||||||
| #endif | #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); |                 status = ReadFile(s->stream->handle, state->chunk_buf, chunk_size, NULL, &state->overlapped); | ||||||
|                 if (!status && (ERROR_IO_PENDING != WSAGetLastError())) { |                 if (!status && (ERROR_IO_PENDING != WSAGetLastError())) { | ||||||
|                     if (WSAGetLastError() == ERROR_BROKEN_PIPE) { |                     if (WSAGetLastError() == ERROR_BROKEN_PIPE) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose