tarcieri/nio4r — pull request #13 by loganb (2012-11-25 18:36:14+00:00)
Title: Fix broken specs on OS X 10.8

Tests involving unwritable_subject were failing for me on OS X 10.8, this patch fixes it.

Of note, in OS X select() will report some pipes as writable, however, a write() call to the pipe with fewer than PIPE_BUF bytes will fail with EAGAIN. This is because all writes less than PIPE_BUF in size are guaranteed to be atomic so the OS will fail the whole call if there is not enough space rather than do a partial write. This behavior is somewhat nonsensical and has implications for any non-blocking I/O frameworks on OS X as it is no longer possible to determine when a write to a pipe might succeed.

This patch at least works around the problem by writing a very large string that is bigger than PIPE_BUF on basically all platforms. Kinda hackey, but at least it works.