patch applied (packages/base): Windows: map ERROR_NO_DATA to
EPIPE, rather than EINVAL
Simon Marlow
marlowsd at gmail.com
Wed Sep 15 12:04:59 EDT 2010
Wed Sep 15 07:26:18 PDT 2010 Simon Marlow <marlowsd at gmail.com>
* Windows: map ERROR_NO_DATA to EPIPE, rather than EINVAL
WriteFile() returns ERROR_NO_DATA when writing to a pipe that is
"closing", however by default the write() wrapper in the CRT maps this
to EINVAL so we get confusing things like
hPutChar: invalid argument (Invalid Argumnet)
when piping the output of a Haskell program into something that closes
the pipe early. This was happening in the testsuite in a few place.
The solution is to map ERROR_NO_DATA to EPIPE correctly, as we
explicitly check for EPIPE on stdout (in GHC.TopHandler) so we can
exit without an error in this case.
M ./GHC/IO/FD.hs -1 +13
M ./cbits/Win32Utils.c -1 +4
View patch online:
http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=packages/base;a=darcs_commitdiff;h=20100915142618-12142-979682426a4cf44d28897a2aa44bc09fcf35a38e.gz
More information about the Cvs-libraries
mailing list