WSL
WSL copied to clipboard
zero-length read() should return immediately
tested on rs_preview build 14905.
Run the following C++ program:
#include <unistd.h>
int main(void)
{
int fds[2];
pipe(fds);
char buf[0];
read(fds[0], buf, 0);
return 0;
}
On "real" Linux, this returns immediately. On Windows, it hangs indefinitely.
Found this by running the .NET Core System.IO.Pipes tests; we have a test case that expects a zero-length read from an empty pipe to return immediately.
@ericeil - Thanks for reporting the issue and providing simple repro steps. I have logged a bug internally to track it.
Looks like @sunilmut's fix went out a few releases ago here. Marking this one as fixed and closing.